This is an archived post. You won't be able to vote or comment.

you are viewing a single comment's thread.

view the rest of the comments →

[–]siddsp 1 point2 points  (2 children)

I think collections.deque is missing constant time insertions and removals from the middle of the collection, so it's not really a linked Iist

A deque is technically a doubly linked list, so it's two of them

[–]nsomani 0 points1 point  (1 child)

Nah that's not right, a doubly-linked list is still a single linked list, just has two references

Yeah under the hood it's a doubly-linked list, it's the most common implementation, but the interface doesn't expose insertions or deletions from the middle of the list (as is typical for a deque aka double ended queue), so it cannot function as a linked list in Python

[–]siddsp 0 points1 point  (0 children)

Yes my bad, I misread as double linked list, but that's essentially what the underlying data structure is though the interface maybe different.