HotshardLearn ↗LRU Data StructurePUTGET

LRU Data Structure — pick a scenario

0/4 done

Pick one and press Start, then click Next › to step through it.

Watch for

The list growing leftward at the head while the map gains a matching row for every key you add.

More about this scenario
You'll learn

That an insert registers a key in two places at once — the map for finding it and the list for ordering it by recency.

How it runs

Each PUT of an unseen key builds a node, links it just behind the head sentinel as the most-recently-used entry, and adds a key-to-node entry in the map.