by panda88888 · 7y ago · 0 comments
For example, for a full DEQ, in order to perform a push, I would have to:
1. Pop the last element
2. Move all element to the right by 1
3. Push the item into position 0
This would be a linear operation. Unless the address of the starting and ending element can change, I don’t think it’s possible to get both push and pop to less than linear time.
Edit: I was wrong--key is circular buffer
Edit: should have thought of that. Brain fart—-long day at work.