Hacker News new | ask | show | jobs
by Sandworm5639 894 days ago
Why call it "FIFO queue"(isn't it just stack?) when actually you need to remove elements from the middle?

Also I think you could do away with storing "prev" for each node and make it like std::forward_list(with some additional work during eviction).

> We pushed SIEVE a bit further by letting it peek into the future – well, sort of. We tested how well it could guess the next request. It turns out, with this extra bit of foresight, SIEVE is nailing it, outperforming the rest in almost all scenarios.

No idea what they mean here.

2 comments

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.

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.
I think they invoke FIFO because hand pointer start at tail so the first-in objects have first the chance to get evicted (be out).