✧Delphi 5 time capsule/Thread Sorting Demo, reimagined · with three very opinionated algorithms/1999 → Today

A Little Order
Out of Chaos.

Three sorting algorithms receive exactly the same scrambled numbers. Three different strategies attempt to bring order to the confusion. Watch the little bars find their places.

A vintage Delphi experiment, given a new stage. No exam. No hurry.
Ready. Each algorithm begins with the same numbers.
01 · The patient neighbor

Bubble sort

Compare neighbors. Exchange any pair that's out of order. Repeat, and repeat, and repeat.

Bubble, the patient neighbor says…

Hold yer horses! My great-pappy swapped neighbors, and so will I. It'll be done when it's done.

Peek at my little ruleif left > right: swap(left, right)

Keep walking along the line, checking two neighboring bars at a time.

Waiting0 / 0
0
0
02 · The eager collector

Selection sort*

Find a smaller value and swap it immediately. This old Delphi version has its own impatient personality.

Selection, the eager collector says…

Ooh, a smaller one! Let's swap it NOW. Why wait until the end?

Peek at my little ruleif candidate < front: swap(front, candidate)

This particular Delphi-era version swaps as soon as it spots a smaller value, unlike textbook selection sort.

Waiting0 / 0
0
0
03 · The divide-and-conquer artist

Quicksort

Pick a middle value, partition the crowd around it, then solve smaller puzzles recursively.

Quicksort, the strategist says…

Divide the work. Let the smaller teams handle it. Make it so.

Peek at my little rulepartition around pivot sort(left side); sort(right side)

Split a big sorting problem into smaller sorting problems, then repeat.

Waiting0 / 0
0
0

Three ways to make sense of a mess

Meet the characters: Bubble is stubborn, Selection is impatient, and Quicksort loves a plan. Their little remarks are just for fun; the colored bars and the counters show what the algorithms actually do.

Watch carefully: quicksort often finishes early because it partitions the problem, rather than repeatedly inspecting the entire line. On nearly ordered inputs, different strengths and weaknesses emerge.

Try One beat to observe comparisons and exchanges slowly. All three lanes advance by one observable algorithm operation each time.

A note from the Delphi attic

Inspired by Demos/Threads/sortthds.pas and thsort.pas in the classic Delphi 5 demonstration library. The original launches three TThread workers and safely draws through VCL's Synchronize.

This is a fresh JavaScript visualization, not an execution of the Delphi binaries or a multi-threaded benchmark. Comparisons and exchanges are counted from the algorithms; the animated durations are deliberately controlled for teaching. *The vintage selection routine swaps early, unlike the more familiar textbook variant.