Algorithm complexity – O(log n), O(n), O(n log n), O(n²) and a sorting race

Computer ScienceAlgorithms & Problem SolvingAges 15–16

Loading…

Share Report a problem

A chart plots the number of steps against input size n for the functions log₂n, n, n·log₂n and n², alongside comparison counts measured live for bubble sort and quicksort. Students drag the n marker on the chart to read off values, then click Race to watch both algorithms sort the same array at the same step rate: quicksort (n log n) finishes before bubble sort (n²), and the gap grows as n increases.