Skip to content
All games

Big-O race

How fast does your code stay?

Race two ways of doing the same job and see which stays fast as it grows.~3 min

Big-O race: n² vs n

Nested loopsO(n²)

400 operations

Set-basedO(n)

20 operations

At n = 20, the nested loops do 400 operations while the set does 20 · that is 20× more work.

Found something unclear, outdated or improvable? Suggest an improvement