Reputation: 464
What is the time complexity for accessing deque[0], deque[somewhere in the middle], and deque[-1]?
Upvotes: 2
Views: 742
Reputation: 782785
From the documentation:
Indexed access is O(1) at both ends but slows to O(n) in the middle. For fast random access, use lists instead.
This suggests that the implementation is a doubly-linked list.
Upvotes: 5