I am looking for some clarification / confirmation here.
To my understanding, a Stack can be implemented with a Singly Linked List because all stack operations are performed on the top (head) of the stack. In other words, every stack node only needs a pointer to the next
node.
However, in a Queue, we need to perform operations at both the front and the back of the queue (ie. enqueue() and dequeue()). Does that mean, that a proper Queue implementation must be built on a Doubly Linked List (ie. a Linked List where each node has both a next
and previous
pointer)?
Thanks!