STL deque accessing by index is O(1)?

I found this deque implementation from Wikipedia:

Storing contents in multiple smaller arrays, allocating additional
arrays at the beginning or end as needed. Indexing is implemented by
keeping a dynamic array containing pointers to each of the smaller
arrays.

I guess it answers my question.

Leave a Comment