Comment

Comment by kbutler

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.

parent kbutler 2 years ago

Discussion

Live from the official Hacker News API

A modern reader for Hacker News · SvelteKit + Skeleton