DSA Factory
All free lessons
Level 1 · Foundations

Free Complexity lessons

8 lessons, about 59 minutes in all. Each teaches one idea with a visual, then gives you one problem built for it. Read the lessons here, then create a free account to solve the problems and keep your progress.

Stage 0Counting work

  1. One loop, countedWork out how many times a loop runs, without running it.7 min
  2. Loops inside loopsCount the work of a loop nested in another loop.8 min
  3. Halving is fastSee why a loop that halves n finishes in a few dozen passes.6 min
  4. Will it be fast enough?Estimate an approach's work and compare it with what fits in a second.8 min

Stage 1Growth in practice

  1. Add or multiply?Loops one after another add their work; loops inside each other multiply it.6 min
  2. Only the biggest term mattersName an algorithm's growth by its fastest-growing part.7 min
  3. When constants winFor small n, a slower-growing algorithm with a big constant can lose.8 min
  4. Cheap on averageA growing list doubles its space now and then, and the copying still averages out to a little per item.9 min

There’s more after this

These are the opening stages of Complexity. The full path climbs on to harder problems and a mastery test. Create a free account and we’ll keep your place.

Start the full path free