Index

Free, with Google

Keep going, free.

A free account opens lessons 2 and 3 of every track, 33 more lessons, and keeps your progress and review cards on every device.

Start free with Google

A chalk plan

Open everything on chalk.

Every lesson, board, video, lab and paper, and the full review decks. Yearly is $39/year.

See plansStart free instead

Module 03 · DSA · Worked, and deeper · about 21 min to read

Play it as a journeyTutor comes with a plan

Complexity Theory (when problems are hard)

When Problems Are Hard
When Problems Are Hard · Open board

Three cliffs, drawn side by side: a cost that calls smaller copies of itself, a cost that’s cheap almost every time and expensive once in a while, and a cliff nobody has ever found a way around.

Before you start. You already know how to read a cost off a line of code, count the loops, and see whether doubling the input doubles the work (Complexity & Big-O). This lesson is the three cases where that trick alone isn’t enough: a job that calls smaller copies of itself, a job that’s fast almost every time and slow once in a while, and a job nobody has ever managed to speed up at all.

Lesson 25 of 96 in DSA

The rest of this lesson is part of a plan.

A plan opens every lesson, board, video, lab and paper on chalk. Yearly is $39/year.

See plansAlready a member? Sign in

Or start free: a free account opens lessons 2 and 3 of every track.

In this lesson

  • 1956: a letter with a question nobody has answered since
  • A job that hires copies of itself
  • The box that doubles
  • 1971 and 1972: some hard problems turn out to be one hard problem

Terms it explains: master theorem, amortized, NP, NP-complete, NP-hard, reduction, Approximate, Heuristic, Exact but pruned, Restrict the input.

Lab

Ten cities, and you can check every possible route. Eleven, and you cannot. So what do you ship for the eleventh?

Set Cities on the map to 10, read The gap, then add one city and watch that number disappear.

Open The cliff at n = 11

Review DSA