I am learning about queue data structure in python. I learnt the implementation of a queue using list in python and the issue of memory wastage when we dequeue a few elements from the front. We use a circular queue ( wrap around from the last index to the first) to overcome this issue. All fine and dandy!
Then we learn about using linked list to implement a queue and then textbooks show circular linked list ( tail pointing back to head) to implement a circular queue. But is that needed? There is no issue of memory wastage in linked list, therefore there should be no concept of "circular". But everywhere I see, there is a circular linked list to implement a "circular" queue. Does making the linked list "circular" add any value if we already maintain the head and tail pointer ( like in leetcode 622).
Similarly, when we implement a deque ( leetcode 641), we use a doubly linked list(DLL) and usually people again connect the tail pointer to the head pointer. But in terms of the interface (or ADT) of a deque its not really needed ( or is it?)
I tried submitting the code with and without the "circular" linked list and both seem to work ( as it should!).
Can someone clarify this for me. Am i missing something here?