AlgoLearn

Algorithms you can watch run.

Each episode builds one algorithm as a small workshop machine. Step through it, slow it down or feed it your own numbers, and follow the Kotlin or Python line by line as it runs. Episodes open in Polish — switch to English at the top of the page.

Quicksort

On average quicksort makes about 1.39 · n log₂ n comparisons: 14 for these 8 weights (bubble sort on the same order: 28) and about 25 million for a million. On already sorted input the last-element pivot is always the largest: n(n − 1)/2 comparisons and a call stack n deep, so a sorted million throws StackOverflowError on the JVM.

Open the episode →

Bubble sort

Without the flag, bubble sort always makes n(n − 1)/2 comparisons: 28 for 8 elements and about 500 billion for a million. The swapped flag stops early when a pass made no swap, but the worst case is still O(n²).

Open the episode →

Binary search

Every comparison throws away half of the range, so n elements need at most ⌈log₂(n + 1)⌉ comparisons: 4 for 15 elements and 20 for a million.

Open the episode →