Oh My AlgorithmKO
←
Complexity
← All catalogs

Complexity

Growth of operation counts and auxiliary storage

Time Complexity

Principles and uses

Compare how operation counts grow with input size.

Use Choosing algorithms for larger inputs

Compare operation counts as the input grows.

025651276810242481632nn: 2n²: 4⌊log₂n⌋+1: 2Operation count model
↔ Drag to explore
Learn more

The models count n visits, n² nested iterations, and floor(log₂n)+1 worst-case binary-search comparisons. Big-O is an upper bound, not elapsed seconds or a guarantee of speed on every input. Constants and implementation details still matter.

Space Complexity

Principles and uses

Compare extra memory needs as input grows.

Use Comparing copies, recursion and in-place work

Space complexity tracks memory growth; this example counts auxiliary space, excluding the input.

Input storage: 8Auxiliary storage: 0Input excluded · one slot per element or variablen=8 · input
↔ Drag to explore
Learn more

Auxiliary space is separated from input storage. The diagram counts one element or variable per slot, not real byte sizes. Include copies and recursive call stacks, and state whether output storage is included.

Learning topics