Hacker News new | ask | show | jobs
by ncruces 894 days ago
A stack is actually LIFO?

Otherwise, yeah, if you remove elements from the middle, you either need a structure that allows it, or you amortize it by making such updates less frequent. Still not a queue.

1 comments

If you need middle or random access then it’s an array, neither a queue nor a stack :)

I couldn’t understand the animation at all. LRU is much simpler to understand and implement what’s so complicated about a doubly linked list ?

The median could trivially be the root of a red/black tree.