4 ms·
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 suc
by ncruces 3y 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.
- deepGem 3y agoIf 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 ?
- xxs 3y agoThe median could trivially be the root of a red/black tree.