Programming Fundamentals · Part Summary

Summary · Five Algorithm Ideas at a Glance

Twelve lessons done—time to close the net. This chapter really only taught five kinds of ideas, and each has a real face in AI. This page takes the whole chapter home in one big table, then uses 8 scenario questions to test whether you can “spot it at a glance”—see a problem and know which idea to reach for.

One big table · Five ideas × AI's real face
IdeaOne-line mottoReal face in AIRelated lessons
📈Complexity Big-O First ask “what if data grows 10×” Attention is O(n²): longer context, compute grows by the square—and so does the bill algo-1algo-2
🔍Search and Sorting Ordered → cut in half; unordered → sort first Rerank: RAG-retrieved passages go through coarse ranking then fine ranking—sorting at heart algo-3algo-4algo-5
🪆Recursion and Divide-and-Conquer Break a big job into the same smaller job Compaction: split a long chat, summarize each slice, merge—that's divide and conquer algo-6algo-7
🧭Graph search BFS/DFS Sweep layer by layer, or go all the way down one path Coding Agent finding files: walk directories in a codebase, dig deep along reference chains algo-8
🎲Greedy and Sampling Pick the max each step, or roll the dice by probability Temperature / Beam Search: AI's two personalities when picking words, and “look a few steps ahead” algo-9algo-10
Spot it in one shot · 8 scenario questions

In real work nobody tells you “this is a binary-search problem.” Read the scenario, pick which idea to use, get instant feedback.

Two chapters side by side · Store × Process

🗃 Data Structures Part: how to store

Arrays, stacks, queues, hashes, caches, trees, graphs, vectors—eight ways to store, deciding where data lives and how you find it.

×

⚙️ Algorithms Part: how to process

Complexity, search & sorting, recursion & divide-and-conquer, graph search, greedy & sampling—five processing ideas, deciding how to compute and how fast.

Eight structures × five ideas = your full toolkit for reviewing AI-written code. See a stretch of AI-written code—first ask “where does it store the data” (structure), then “how does it plan to process it” (algorithm), then “what happens if data grows 100×” (complexity). Ask those three and the gap between “it runs” and “it ships” shows itself. You don't need to write it—from today on, you can see through it.

✅ What this chapter wants you to take away