Why is adding to or removing from the middle of a collections.deque slower than lookup there?
问题 This wiki.python.org page on algorithmic complexity of some data structures says the following for a collections.deque object: A deque (double-ended queue) is represented internally as a doubly linked list. (Well, a list of arrays rather than objects, for greater efficiency.) Both ends are accessible, but even looking at the middle is slow, and adding to or removing from the middle is slower still. Two questions: 1) Is adding to the middle of a deque even possible? I don't see any method to