Sorting Lab

Complexity

Big-O Comparison

Theoretical growth makes the difference between linear, n log n, and quadratic work easier to see than raw browser timing.

Chart

Growth by input size

n=8
64
n=16
256
n=32
1,024
n=64
4,096
n=128
16,384
n=256
65,536
Red: O(n^2)Blue: O(n log n)Green: O(n)

Numbers

Sample operation counts

nO(n)O(n log n)O(n^2)
882464
161664256
32321601,024
64643844,096
12812889616,384
2562562,04865,536