Programming Fundamentals · What You Can Do Now

Check AI-Written Code Once Through

The whole chapter said “you don’t have to write code, but you do need to check it”—today you actually check something real. Three tiers by how much time you’ll put in: the lightest one takes 30 minutes; in a week you can turn checking into a work habit. Every tier ships with a ready-to-use prompt.

Pick a tier · start today
🥉

Task 1 · Make AI account for itself

First step of checking: don’t read the code—audit the confession

30 min

Grab a piece of code AI already wrote for you (don’t have one? Ask AI to write a small “contact-list dedupe” tool: take a pile of names + phone numbers, drop the duplicates). Then throw the prompt below at it and make it confess which way of organizing it used.

For the code you just wrote, answer three questions in plain language — I’m not a programmer: 1. What data structure did you use to store this data? (array, hash table, or something else?) 2. Why that one and not something else? Name at least one alternative you rejected and why; 3. If the data volume grows 1000× (say from 100 rows to 100,000), how much slower does this code get? Which line breaks first? If you realize your choice wasn’t actually optimal, say so honestly and give a better version.
Done when: you can retell in your own words “what structure it used, why, and what happens when data grows”—if you can’t retell it, chase AI for another round.
🥈

Task 2 · Demand a different organizer

Same feature, two implementations—you’re the judge of trade-offs

Half a day

Take Task 1’s code and have AI rewrite the same feature with a different data structure, then list a trade-off table for both versions. The key is the last step: don’t let AI deliver the verdict—you decide which version fits your scenario.

Please re-implement this same feature with a different data structure (e.g. if you used an array, switch to a hash table/Set; if you used a hash table, switch to an array), then: 1. Paste the full code for both versions, with comments on key lines explaining “what this line is doing”; 2. Make a trade-off table comparing at least four dimensions: lookup speed, insert speed, memory use, code readability; 3. Separately say: when version A is better, when version B is better, with one concrete example each (how much data, how frequent the ops); 4. Don’t decide for me — leave the judgment to me. My scenario is: (describe your real situation, e.g. “personal tool, a few hundred rows at most” or “shipping to tens of thousands of users”)
Done when: you picked based on your own scenario and can say “because my data volume is X and my most frequent op is Y, I pick this”—if you can’t say that sentence, AI still made the call for you.
🥇

Task 3 · Pick a structure for your own project

Choose yourself first, then compare answers with AI

1 week

Pick a real need on your plate (work project or personal tool—either’s fine). Don’t ask AI yet—use the “how do I look up / how do I get in and out” decision mantra from ds-summary and pick the data structure yourself; then let AI independently produce a selection plan and see whether you two agree. Run the self-check list below first so the scenario is clear before you start.

📋 Pre-selection self-check (tick all before asking AI)
How big will the data grow? Hundreds of rows now, or millions later—scale decides everything
Is the most frequent op lookup or insert? Read-heavy vs write-heavy → completely different answers
Do you need to keep order? If you need time / ranking order, many structures are out immediately
Do you need dedupe? Built-in uniqueness is Set / hash’s home turf
Is a cache worth it? If the same query keeps happening, think about ds-6’s invisible discount
🎉 All five questions clear—you’ve already done the step most engineers skip. Take these five answers to AI and the plan you get will be a tier higher.
I have a real need for data-structure selection. I’ve already picked myself. Don’t give the answer yet—follow this process: My need: (one-sentence description, e.g. an inventory lookup tool for the company’s 5000 SKUs) My scenario params: data volume ~X rows, most frequent op is X, need order?: X, need dedupe?: X, do the same queries repeat?: X Please: 1. Independently give your selection (what structure to store with, and why)—don’t ask what I picked yet; 2. Estimate performance under my data volume (roughly how fast one lookup / one insert is); 3. Say whether the plan must change when data grows 10×, and how. After you answer I’ll reveal my pick and we’ll compare: if we match, we cross-check; if not, we debate whose reasoning holds up better.
Done when: you and AI agree on the pick (cross-check success), or you disagree but you can follow its reasons and state yours in the debate—both endings count as a win; the failure mode is never having chosen yourself at all.
Why the order is “pick yourself first, then ask AI”? The other way around, AI’s answer instantly overwrites your thinking—you never learn what you would have chosen. Checking skill grows in the gap of “I picked differently from it—why?”
Also remember · three red-flag signals when checking

While doing the tasks, if you see these three signals in AI’s answers, chase one more round of questions.

🚩
Nested loops hunting for things

Two layers of for comparing one by one—that’s ds-1’s “big drawer inside a big drawer.” Ask once: “Would a Set / hash table be faster?”

🚩
Can’t name what it rejected

When you ask for alternatives it only praises the current pick and can’t name a rejected option—that means it never selected; it just defaulted.

🚩
Demo only on tiny data

A demo flying on 10 rows means nothing. Always ask: “What if data grows 1000×?”—the most valuable sentence in this chapter.

✅ What this lesson wants to share