Skip to main content

Complexity Intuition & AI as Assistant

beginner12 min readLesson 49 of 169

Nested loops are the first suspect; interrogate AI answers like a reviewer.

Complexity intuition (no math required)

# One pass over the data โ€” fine for 10 or 10,000,000 items.
for item in items: ...

# One pass per item โ€” 1,000 items = 1,000,000 comparisons. Feel the heat.
for a in items:
    for b in items: ...

You will formalize this in Intermediate (it is called Big-O). For now, carry the intuition: nested loops over the same data are the first suspect when a program is slow. Often there is a one-pass alternative โ€” and the standard library usually has it.

AI as an assistant, not an oracle

When you ask AI for help:

  1. Ask for explanations and hints first, code second: "Why does my loop skip the last item?" beats "write this for me".
  2. Never trust, always verify: run the code, read every line, test the edges yourself. AI confidently invents functions that do not exist.
  3. Interrogate the answer: "What happens with an empty list?" โ€” make the AI defend its code, like a code reviewer would.

The course lets AI explain and hint, never hand you graded answers โ€” the same discipline you should carry into your own tools.

Now practice

Transformation & AI CritiqueBuild new data from old โ€” and audit what an AI would hand you.4 challenges ยท ยท ~35 min