What is the difference between them? I know that
A queue is designed to have elements inserted at the end of the queue, and elements removed from the beginning of the queue. Where as Dequeue represents a queue where you can insert and remove elements from both ends of the queue.
But which is more efficient?
Plus what's the difference between them two? cause i have a bit of knowledge about them, what i said above, but i would like to know more about them. It will be appreciated.
Deque is short for "double ended queue". With an ordinary queue, you add things to one end and take them from the other. With a double ended queue, you can add things to either end, and take them from either end. That makes it a bit more versatile; for example, you could use it as a stack if you wanted to.
In terms of efficiency, it really depends on the implementation. But generally speaking, you wouldn't expect a deque to outperform a queue, because a (single ended) queue could be implemented in a way that doesn't allow objects to be added or removed at the "wrong" end. Whereas any implementation of a deque would also work as an implementation of a queue.