With an array based deque why is add and remove from the front ammortized O(1)? It would make sense to me that it would always be O(n) because either operation would mean that the current values of the array would need to be "moved" over to the the right of the 0 index to add and over to the left to remove...
My professor says that you don't need to shift, just update hi and lo. I'm not entirely sure what he means.
This is not a C++ question per se, but I am trying to understand it in this language.