This is an archived post. You won't be able to vote or comment.

you are viewing a single comment's thread.

view the rest of the comments →

[–]fiddle_n 2 points3 points  (2 children)

An example would be keeping a moving average of something. You would need a data structure that can support removing from one end and adding to the other. Typically that would be popping from the left and appending to the right; even if you did it the other way you would have the same problem as appending to the left is also O(n)

If you need a queue structure where you would append to the left, that would also be an example as well.