Programming Fundamentals · Part Summary

Recap · Eight Structures, One Decision Table

Ten lessons done—all eight ways of organizing laid bare. This page adds nothing new. One job only: put them on the same table so later you can name the structure the moment you see the scenario. Scan the decision table, then play the picker and quick quiz to check whether you can really review AI-written code.

1 · Eight ways of organizing, one table

One structure per row: a one-line motto, its brightest strength, its sorest weakness, its real form in the AI world, and which lesson covered it. Watch for the “Weakness” column—the cost of picking wrong is all written there.

StructureOne-line mottoStrengthWeaknessIts real form in AISource
📚Array Sit in a row, find by index Direct by position; fast append at the end Insert / delete in the middle shifts everyone message list: every line you chat with the AI lives here Lesson 2
🥞Stack Last in, first out Undo, backtrack, reverse the path You can only touch the top one Cmd+Z, function calls, Agent subtasks; runaway recursion → “stack overflow” Lesson 3
🚶Queue First in, first out Fair line; peak shaving as a buffer No cutting; can’t grab the middle Task queues, message queues: an Agent’s work gets done in line Lesson 4
🗃Hash table Compute the slot, one-step direct hit Lookup / dedupe unreasonably fast No order; costs extra memory Set / dict, session lookup, cache keys, corpus dedupe Lesson 5
💾Cache Don’t recompute what you’ve already done Saves time and money When to invalidate is the hardest call KV Cache, semantic cache, browser cache, CDN—the invisible discount on your bill Lesson 6
🌳TreeVariant: Trie (prefix tree) Branch layer by layer; find by level Naturally expresses nesting and hierarchy Only parent–child; peer links don’t fit File trees, JSON, AST; Trie is how Tokenizers cut words Lessons 7 / 9
🕸Graph Anything can link to anything Expresses arbitrary many-to-many relations Easy to cycle; traversal gets expensive Knowledge graphs, social nets, multi-Agent DAG workflows Lesson 8
🧭Vector Meaning → coordinates; similar = nearby Find things by “how alike” Results are approximate; need a special index Embedding + RAG retrieval: find nearest neighbors; HNSW makes hundred-million-scale instant Lesson 10

💡 On phones, swipe the table left/right to see more

2 · Scenario picker: see the scene, name the structure

Memorizing the table doesn’t count—picking does. Eight real scenarios below: decide in your head first, then tap a card to check. Finish all eight for a surprise.

Checked 0 / 8 scenarios

🎉 All eight scenarios cleared! You’ve got what this chapter most wanted to give you—seeing a scenario and naming the way of organizing. Next time AI ships code, you’re not just the bystander who hits “Run”—you’re the reviewer who can ask “why is this an array walking one by one?”
3 · Quick quiz: intuition for checking AI code

Six either/or questions, each from a key judgment in the ten lessons. Tap for instant feedback—watch for the “why” in the explanation; that’s what you say out loud when reviewing.

Finale · one decision mantra
Facing any data scenario, ask only two questions. First: “how do I look it up?” By position → array; by key → hash table; by hierarchy → tree; by relation → graph; by similarity → vector. Second: “how do things enter and leave?” FIFO → queue; LIFO → stack. Plus one cross-cutting thrift mantra: don’t recompute → cache. Two questions, one mantra—that’s the whole skeleton of these ten lessons.

✅ What this chapter wants you to take away