Course guide hub
About this reference
Use this as the front door: week pages, analysis toolkit, bridge notes, and review blocks are separated for easier teaching.
Find a topic in this reference
Separated Guide Pages
The old single guide has been split into focused pages. Use the weekly pages during class, and keep the toolkit, bridge notes, and review blocks open as references.
Algorithm-analysis toolkit
The reusable methods students need every week: counting, asymptotic proofs, traces, measurement, and explanation routines.
Math BridgesDiscrete math bridge notes
Short, teachable bridges from programming habits to sums, logarithms, proofs, and growth-rate comparisons.
Exam PreparationReview blocks and timed practice
Midterm, final, Python fluency, and challenge review blocks aligned with the weekly algorithm-analysis sequence.
Weekly Teacher Notes
Week 01 — What Is an Algorithm?
Detailed teacher notes, original lesson link, analysis prompts, model solutions, and added timed-practice material.
Week 02Week 02 — Your First Python: Values, Names, and Output
Detailed teacher notes, original lesson link, analysis prompts, model solutions, and added timed-practice material.
Week 03Week 03 — Repeating Work: Loops and a Step Counter
Detailed teacher notes, original lesson link, analysis prompts, model solutions, and added timed-practice material.
Week 04Week 04 — Lists: Holding Many Things at Once
Detailed teacher notes, original lesson link, analysis prompts, model solutions, and added timed-practice material.
Week 05Week 05 — Functions and trustworthy timing
Detailed teacher notes, original lesson link, analysis prompts, model solutions, and added timed-practice material.
Week 06Week 06 — Doubling experiments, plots, and noisy evidence
Detailed teacher notes, original lesson link, analysis prompts, model solutions, and added timed-practice material.
Week 07Week 07 — Exact operation counts and dominant growth
Detailed teacher notes, original lesson link, analysis prompts, model solutions, and added timed-practice material.
Week 08Week 08 — Big-O, precise bounds, cases, and space
Detailed teacher notes, original lesson link, analysis prompts, model solutions, and added timed-practice material.
Week 09Week 09 — One problem, four strategies
Detailed teacher notes, original lesson link, analysis prompts, model solutions, and added timed-practice material.
Week 10Week 10 — The real cost of list operations
Detailed teacher notes, original lesson link, analysis prompts, model solutions, and added timed-practice material.
Week 11Week 11 — Sets, dictionaries, and preparing once
Detailed teacher notes, original lesson link, analysis prompts, model solutions, and added timed-practice material.
Week 12Week 12 — Binary search, boundaries, and preparation
Detailed teacher notes, original lesson link, analysis prompts, model solutions, and added timed-practice material.
Week 13Week 13 — Sorting: count the work and preserve the meaning
Detailed teacher notes, original lesson link, analysis prompts, model solutions, and added timed-practice material.
Week 14Week 14 — From a correct algorithm to a convincing report
Detailed teacher notes, original lesson link, analysis prompts, model solutions, and added timed-practice material.
Algorithm Analysis with Python · 14 weeks · English explanations with Turkish support
The central question is simple: When the amount of input grows, how does the work grow? We will learn to answer it by following small examples, measuring carefully, counting operations, and explaining a choice. Python makes the steps visible. Understanding those steps matters more than memorising syntax.
Türkçe: Bu rehber her haftayı öğrenirken kullanabileceğin ayrıntılı bir çalışma arkadaşıdır. Önce yöntemin ne yaptığını anlayacağız; sonra küçük bir örneği elle takip edeceğiz; en son işlem sayısını ve büyümeyi açıklayacağız. Formüle bir anda atlamayacağız. Bir sembolü anlamadığında ilgili aritmetik köprüsüne dönebilirsin.
The guide follows the actual AA weekly notes, in their original order. The explanations, small examples, and practice solutions here develop those notes. The original lessons remain the source for their full chapter problem sets and optional extensions. The Skiena companion offers additional worked chapter solutions; it is a later reference, not a prerequisite for Week 1.
Start here
You do not need prior programming experience. Start at Week 1 if variables, loops, or lists are unfamiliar. If you already program, use the Week 4 readiness check before moving ahead: knowing syntax does not automatically mean you can explain its cost.
Use one weekly chapter alongside its original lesson. Do not try to read this entire guide before class. Each chapter provides a question, a retrieval exercise with an answer, slow explanations, worked examples, practice with complete solutions, common mistakes, a vocabulary card, and a readiness check. Read only the arithmetic bridge you currently need.
A practical reading cycle:
- State the problem in everyday words. What is given? What must be returned?
- Predict one tiny example on paper. Use three to six items so every change remains visible.
- Trace the variables. Record values after each relevant step, not only the final output.
- Run the example in the original lesson or a short code block here. Compare it with your prediction.
- Change one detail: a missing target, a duplicate, an empty list, or twice as much data.
- Explain what stayed the same and what changed. Then use the technical term.
Türkçe: Çözümü okumadan önce en azından ilk adımı kendin yaz. Hata yaptığında sadece doğru cevabı kopyalama: “Ben hangi adımın kaç kez çalıştığını yanlış düşündüm?” sorusuna cevap ver. Bir örneği anlamak, çıktısını tanımaktan fazlasıdır; girdi değişince sonucu yeniden bulabilmelisin.
The code examples in this guide are small learning examples. A printed elapsed time is a measurement from that run, not an answer everyone should reproduce. Tables explicitly described as illustrative are arithmetic exercises, not measurements from your machine.
Course map
The calendar remains 14 weeks. Reviews take place inside existing classes in Weeks 4, 6, 8, and 11; they do not add four more weeks. The weekly sequence below matches the course source files tools/weeks/w01.html through w14.html. No calendar dates are inferred from another course's timetable.
| Week | Actual lesson topic | What you should be able to explain | Transition or review |
|---|---|---|---|
| 1 | What is an algorithm? | Input, output, definite steps, termination, correctness, and counting by hand | Everyday instructions → computer instructions |
| 2 | Values, names, and output | Read assignments and evaluate arithmetic one operation at a time | One instruction → repeated instructions |
| 3 | Loops and a step counter | Trace decisions, ranges, counters, and stopping conditions | Repetition → processing a collection |
| 4 | Lists | Separate position access from value search; count successful and missing searches | Review A: explain a complete small program |
| 5 | Functions and the stopwatch | Separate defining, calling, returning, and timing; repeat measurements | One measurement → a controlled comparison |
| 6 | The doubling experiment | Calculate time ratios and interpret a labelled plot without overclaiming | Review B: seconds → operation counts |
| 7 | Counting steps instead of seconds | Choose a cost model, derive T(n), add or multiply counts appropriately | Exact expressions → growth descriptions |
| 8 | Big-O notation | Explain a useful upper bound, its conditions, cases, and auxiliary space | Review C: justify a growth claim |
| 9 | Four anagram algorithms | Compare strategies while preserving the same definition of a match | Strategy → costs hidden in familiar operations |
| 10 | Python list costs | Explain shifting, copying, repeated membership, and amortized append | Container operations → container choice |
| 11 | Dictionaries and sets | Include build cost, average-case lookup, memory, and meaning of the result | Review D: prepare data for repeated questions |
| 12 | Linear and binary search | Trace bounds, explain sortedness, and account for preparation | Searching sorted data → obtaining sorted data |
| 13 | Sorting | Trace bubble and selection sort; derive comparison counts; compare with sorted() | Separate correctness, growth, and measured performance |
| 14 | Putting it together | Defend two correct approaches using counts, benchmarks, and limitations | Project, cumulative review, engineering interpretation |
The first phase teaches the Python needed for analysis. Weeks 5–6 develop experiments. Weeks 7–9 develop the language for explaining experiments. Weeks 10–14 use that language to choose methods. When a later chapter is difficult, identify the missing link rather than restarting the entire course.
How the three-hour class stays manageable
| Time in class | Ordinary week | Review weeks 4, 6, 8, 11 |
|---|---|---|
| 00:00–00:10 | Retrieve an earlier idea and state today's question | Same; use a tiny repair example if needed |
| 00:10–01:00 | Explain, predict, run, discuss; pause for questions | Teach the week's essential ideas |
| 01:00–01:10 | Break | Break |
| 01:10–02:00 | Worked example, changed input, explanation to a partner | Finish a representative core example and check it |
| 02:00–02:10 | Break | Break |
| 02:10–02:50 | Core engineering practice and exam bridge | Protected review of familiar ideas |
| 02:50–03:00 | Questions, summary, exit ticket | Review exit ticket and specific repair plan |
A review week still includes its scheduled topic. Make room by choosing representative examples from the notes and leaving optional extensions for later. Do not remove a break or rush through every optional problem. The review plans later in this guide include actual questions, full solutions, and a way to decide what needs another pass.
Türkçe: “Tampon” burada takvime boş hafta eklemek değildir. Zor bir kavramdan diğerine geçmeden önce, mevcut haftanın son 50 dakikasını önceki fikirleri birleştirmeye ayırmaktır. Bir sonraki haftanın ilk 10 dakikası da gerekirse küçük bir onarım örneği için kullanılır. Böylece aynı yanlış anlama haftalarca taşınmaz.
Three different questions: answer them separately
Consider finding a target in a list. These three statements answer different questions:
| Question | Example answer | What it does not establish |
|---|---|---|
| Is the result correct? | A full scan returns whether at least one item equals the target, including the empty-list case | How fast it runs |
| How much work is done? | An absent target requires n equality checks in this simple scan | Exact seconds on a laptop |
| How long did this run take? | The measured elapsed time was recorded with a stated timer and repeat policy | A proof about every larger input |
Correctness comes first. Comparing a function that returns the first matching position with one that returns only True or False requires care: they do not have the same output contract. Replacing a list with a set can change the meaning of duplicates and order. Faster output is useful only if it is the output the problem requires.
Türkçe: “Doğru cevap”, “işlem sayısı” ve “geçen süre” üç ayrı değerlendirmedir. Sınavda veya projede bunları ayrı cümlelerle yaz. “Hızlı çalıştı, o hâlde doğru” ya da “O(n), o hâlde şu kadar saniye” çıkarımları geçerli değildir.
A reusable answer structure
Use this structure for a trace, an analysis exercise, or your project:
- Contract: The input is … and the required output is … . Assume … .
- Size: Let n be … . If a second size matters, let m or q be … .
- Case: I am analysing all inputs, the worst case, or a stated input arrangement.
- Counted operation: I count comparisons, visits, shifts, or another specified operation.
- Reasoning: This operation happens … times because … . Show the sum or product.
- Growth: Therefore a useful bound is … under these assumptions.
- Evidence and limits: The experiment suggests … . It includes/excludes preparation … . A limitation is … .
For Week 1, use only the first four ideas informally. Add symbols and bounds as the course introduces them. You are not expected to know Week 8 language in Week 2.
Example of a complete short analysis: “Let n be the list length. I count equality checks in an ordinary left-to-right scan. In the missing-target case, every item is checked once, so C(n) = n. The worst-case growth is linear, O(n), assuming an individual equality check has constant cost. The loop stores a fixed number of extra variables, so its auxiliary space is O(1).”
Türkçe: Güçlü cevap uzun olmak zorunda değildir; eksik adım bırakmamalıdır. Önce n'nin anlamı, sonra saydığın işlem, ardından neden n kez yapıldığı ve son olarak büyüme sınıfı gelir. Sembolü açıklamanın yerine koyma.
Assessment and source boundaries
The course home sets the assessment policy: Assessment consists only of the midterm exam (50%) and final exam (50%). Weekly notebooks, exercises, projects, demonstrations and presentations are ungraded practice; no weekly submission is required.
The final project follows Week 14: two correct methods for the same task, measurements at four input sizes, a shared labelled figure, a growth explanation, and an approximately two-page report with a recommendation and an honest limitation. The engineering capstone remains a reading after Week 14.
The primary sources for every chapter are linked in that chapter. Added micro-examples and review exercises are teaching examples built around those source concepts. Harder proof-style and interview-style chapter problems remain available in the original notes and the Skiena companion. Their optional status is preserved.
Türkçe: Rehberdeki ek açıklamalar konu sırasını ve ölçme-değerlendirme düzenini değiştirmez. Amaç, mevcut notları gerçekten anlayabilmen için aradaki düşünme adımlarını görünür kılmaktır.
Meaning, correctness and cost
Each week now opens with a topic-specific explanation of what the operation accomplishes and why its representation fits the problem. Predict the tiny example, draw or trace it, and only then inspect the worked reasoning. Change one input or assumption after checking. Use a state table for assignment, a grid for pair counts, an interval for binary search and a preparation/query account for repeated lookups.
Keep three claims separate: the method returns the required result, its counted work grows in a stated way, and a particular implementation took a measured time. Explain each with the appropriate evidence. A collection of passing examples cannot replace an argument for all allowed inputs, and a timing ratio cannot by itself prove a complexity bound.
The Week 14 sensor-report example connects with PROG/CP1’s final lesson. The scenario is self-contained: CP1 explains reliable processing; AA compares correct methods for the same output. It is optional capstone context, not a new prerequisite or assessment.
Türkçe: İşlemin anlamı, doğruluğun gerekçesi ve işin büyümesi farklı açıklamalar ister. Küçük örneği önce elle izle; sonra sonucu ve maliyeti ayrı ayrı savun.