⚖️ One weighing = one comparison
A sorting algorithm never sees the numbers it sorts. It can only ask "is this one less than that one?" Your balance works the same way. The stones look alike; only weighing reveals the order.
In memory of Tim Peters · 1952–2026
Every time your phone, your browser or a Python script sorts a list, it is probably running the algorithm Tim Peters wrote in 2002. Here's your chance to beat it. Weigh zen stones two at a time on a balance and find their order in fewer weighings than Python's list.sort() needs on exactly the same stones.
Stars: 0 / 48 · ★ sorted · ★★ tied Tim · ★★★ beat Tim (or hit the unbeatable minimum)
Loading gardens…
Shape:
Keyboard: press a stone's letter (A, B, C…) to put it on the scale, Esc to clear, ? for a hint.
list.sort()A sorting algorithm never sees the numbers it sorts. It can only ask "is this one less than that one?" Your balance works the same way. The stones look alike; only weighing reveals the order.
If A is lighter than B and B is lighter than C, you never need to weigh A against C. The game tracks everything you can deduce. Each stone shows the ranks it could still have, and it settles once its place is certain.
"Tim" is the exact comparison sequence CPython's classic list.sort() runs on your stones. For short lists that's a run check (count_run) plus binary insertion, as Tim Peters wrote it. The Lab shows the full algorithm with galloping merges.
Timsort is fast because real data has structure. Each garden tells you something about its stones. Python doesn't get to read the story, so you can beat it by using what it can't know.