Hacker News new | ask | show | jobs
by kbutler 904 days ago
Yes, the illustration is incorrect, and does not match the code's evict function, which only moves the hand after marking the current object "unvisited".

From the initial state, with the hand pointing to A(visited), when the request for H comes in, A is marked unvisited before moving the hand.

When the hand is pointing to D(visited) and the request for I comes in, it should mark D unvisited before moving the hand. This "feels wrong" because D had just barely been marked visited, but it is an implication of the SIEVE algorithm.

It's generally a red flag when a "better, simpler" algorithm is explained with a faulty illustration, suggesting the author overlooked or misunderstood the implications of the algorithm.

1 comments

Thanks for pointing out. We have updated the animation.