Singly linked list vs doubly linked list implementation of queue

In the Queues chapter, one of the implementations used a doubly linked list. I curious why you chose a doubly linked list rather than the plain linked list that we studied in the previous chapter? It seems like a singly linked list would have less overhead and would still be O(1) if you enqueue using append and dequeue with a pop. Or was it to introduce readers to the concept of a doubly linked list?

1 Like

I have same question and would like to understand the necessity to use doubly linked list instead of singly linked list for queue.

It seems that the doubly linked list can achieve double-ended queue, ”for which elements can be added to or removed from either the front (head) or back (tail)β€œ. But if it is just an normal queue, there seems to be no difference

1 Like