AI Model Reviewer

Hash table showdown

Build a hash table collision showdown: four hash tables of 31 buckets each receive the same stream of string keys (words like city names) at the same time, o…

More

1 test · 5 finished runs (5 agent, 0 raw one-shot) · 5 live demos

The prompt

Build a hash table collision showdown: four hash tables of 31 buckets each receive the same stream of string keys (words like city names) at the same time, one insert per tick, using separate chaining, linear probing, quadratic probing and cuckoo hashing with two tables. Show each key flying in, the computed hash value as a number, every probe step as a hop between buckets, chains growing as stacks, clusters forming in linear probing (highlight primary clusters), and cuckoo evictions as keys being kicked out and flying to their alternate slot. Each panel shows live load factor, average and worst probe count, and total probes. When a table passes its load-factor limit (0.75 for open addressing, 0.9 for cuckoo, chaining never), animate a resize to the next prime size with every key re-hashed into place. Every 20 inserts, run a burst of 10 lookups (half present, half missing) and show their probe paths. Controls: key stream presets (city names, sequential numbers as strings, adversarial keys that collide under the default hash), choice of hash function (djb2, FNV-1a, a deliberately bad sum-of-chars), speed slider, play, pause, step, reset. So the page is alive without input, on load it starts streaming the city names automatically and after the stream finishes it waits 3 seconds and moves to the next preset, forever, until the user touches a control. Make it clear enough to teach and pretty enough to watch. Save it as index.html in the current directory: one self-contained file with inline CSS and JavaScript only, no libraries or frameworks, and no external requests of any kind (no CDNs, web fonts, images or audio files). It must work when opened directly from disk, fit any window from a 390 px wide phone to a desktop, and run without console errors. You may serve it locally and open it in headless chromium (/usr/bin/chromium, software WebGL, no GPU) to screenshot and inspect your own output, and iterate on your own before finishing. Close any browser you open as soon as you've taken your screenshot.

Same prompt, all models: step through 5 runsIn the gallery: one player, arrow keys or swipe.

5 of 5 runs shown