Run a Complexity Checkup on AI-Written Code
The Algorithms Part finale: take a real piece of AI-written code through a full checkup—self-report → optimize → measure. Pick one of three tiers by how much time you’ll put in; 30 minutes to start. Reach tier three and you’ll see with your own eyes whether the complexity AI claimed was bluffing.
Task 1 · Account for itself
Have AI label the complexity of its own code
Take a function AI just wrote (if you don’t have one, ask it to write “find the common elements of two lists”—nine times out of ten it hands you an O(n²) version first). Drop the prompt below on it and make it confess how fast or slow it is.
Task 2 · Optimize one tier
Demand a speedup—and demand it spell out the cost
Follow Task 1: if AI self-reported O(n²), ask it to optimize to O(n log n) or O(n)—but the point isn’t just going faster; it’s making it spell out the cost. After finishing ds-6, you should be able to point to which line in its plan is “trading space for time.”
Task 3 · Measure until it can’t bluff
Verify with real data that it isn’t bluffing
Complexity is paper reasoning; the timing curve is hard evidence. Have AI write a benchmark script, generate three scales of random data, time each run, and see with your own eyes how far the before/after curves diverge—and check whether the complexity it self-reported was bluffing.
🩺 Checkup report generator · fill three fields, get a summary you can share in the group chat
✅ What this lesson wants to share
- Checkup in three steps: self-report complexity → optimize and state the cost → measure to verify—each step harder than the last
- The bottleneck line is your handle: once you can say “this line is the slowest,” review has somewhere to grip
- Optimization must talk cost: any speedup that skips readability and memory deserves one more question
- The measured curve is hard evidence: paper complexity can bluff; a timing table across three data sizes won’t