Algorithm Analysis course guide
Algorithm Analysis

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.

Weekly Teacher Notes

Week 01

Week 01 — What Is an Algorithm?

Detailed teacher notes, original lesson link, analysis prompts, model solutions, and added timed-practice material.

Week 02

Week 02 — Your First Python: Values, Names, and Output

Detailed teacher notes, original lesson link, analysis prompts, model solutions, and added timed-practice material.

Week 03

Week 03 — Repeating Work: Loops and a Step Counter

Detailed teacher notes, original lesson link, analysis prompts, model solutions, and added timed-practice material.

Week 04

Week 04 — Lists: Holding Many Things at Once

Detailed teacher notes, original lesson link, analysis prompts, model solutions, and added timed-practice material.

Week 05

Week 05 — Functions and trustworthy timing

Detailed teacher notes, original lesson link, analysis prompts, model solutions, and added timed-practice material.

Week 06

Week 06 — Doubling experiments, plots, and noisy evidence

Detailed teacher notes, original lesson link, analysis prompts, model solutions, and added timed-practice material.

Week 07

Week 07 — Exact operation counts and dominant growth

Detailed teacher notes, original lesson link, analysis prompts, model solutions, and added timed-practice material.

Week 08

Week 08 — Big-O, precise bounds, cases, and space

Detailed teacher notes, original lesson link, analysis prompts, model solutions, and added timed-practice material.

Week 09

Week 09 — One problem, four strategies

Detailed teacher notes, original lesson link, analysis prompts, model solutions, and added timed-practice material.

Week 10

Week 10 — The real cost of list operations

Detailed teacher notes, original lesson link, analysis prompts, model solutions, and added timed-practice material.

Week 11

Week 11 — Sets, dictionaries, and preparing once

Detailed teacher notes, original lesson link, analysis prompts, model solutions, and added timed-practice material.

Week 12

Week 12 — Binary search, boundaries, and preparation

Detailed teacher notes, original lesson link, analysis prompts, model solutions, and added timed-practice material.

Week 13

Week 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 14

Week 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:

  1. State the problem in everyday words. What is given? What must be returned?
  2. Predict one tiny example on paper. Use three to six items so every change remains visible.
  3. Trace the variables. Record values after each relevant step, not only the final output.
  4. Run the example in the original lesson or a short code block here. Compare it with your prediction.
  5. Change one detail: a missing target, a duplicate, an empty list, or twice as much data.
  6. 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.

WeekActual lesson topicWhat you should be able to explainTransition or review
1What is an algorithm?Input, output, definite steps, termination, correctness, and counting by handEveryday instructions → computer instructions
2Values, names, and outputRead assignments and evaluate arithmetic one operation at a timeOne instruction → repeated instructions
3Loops and a step counterTrace decisions, ranges, counters, and stopping conditionsRepetition → processing a collection
4ListsSeparate position access from value search; count successful and missing searchesReview A: explain a complete small program
5Functions and the stopwatchSeparate defining, calling, returning, and timing; repeat measurementsOne measurement → a controlled comparison
6The doubling experimentCalculate time ratios and interpret a labelled plot without overclaimingReview B: seconds → operation counts
7Counting steps instead of secondsChoose a cost model, derive T(n), add or multiply counts appropriatelyExact expressions → growth descriptions
8Big-O notationExplain a useful upper bound, its conditions, cases, and auxiliary spaceReview C: justify a growth claim
9Four anagram algorithmsCompare strategies while preserving the same definition of a matchStrategy → costs hidden in familiar operations
10Python list costsExplain shifting, copying, repeated membership, and amortized appendContainer operations → container choice
11Dictionaries and setsInclude build cost, average-case lookup, memory, and meaning of the resultReview D: prepare data for repeated questions
12Linear and binary searchTrace bounds, explain sortedness, and account for preparationSearching sorted data → obtaining sorted data
13SortingTrace bubble and selection sort; derive comparison counts; compare with sorted()Separate correctness, growth, and measured performance
14Putting it togetherDefend two correct approaches using counts, benchmarks, and limitationsProject, 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 classOrdinary weekReview weeks 4, 6, 8, 11
00:00–00:10Retrieve an earlier idea and state today's questionSame; use a tiny repair example if needed
00:10–01:00Explain, predict, run, discuss; pause for questionsTeach the week's essential ideas
01:00–01:10BreakBreak
01:10–02:00Worked example, changed input, explanation to a partnerFinish a representative core example and check it
02:00–02:10BreakBreak
02:10–02:50Core engineering practice and exam bridgeProtected review of familiar ideas
02:50–03:00Questions, summary, exit ticketReview 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:

QuestionExample answerWhat it does not establish
Is the result correct?A full scan returns whether at least one item equals the target, including the empty-list caseHow fast it runs
How much work is done?An absent target requires n equality checks in this simple scanExact seconds on a laptop
How long did this run take?The measured elapsed time was recorded with a stated timer and repeat policyA 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:

  1. Contract: The input is … and the required output is … . Assume … .
  2. Size: Let n be … . If a second size matters, let m or q be … .
  3. Case: I am analysing all inputs, the worst case, or a stated input arrangement.
  4. Counted operation: I count comparisons, visits, shifts, or another specified operation.
  5. Reasoning: This operation happens … times because … . Show the sum or product.
  6. Growth: Therefore a useful bound is … under these assumptions.
  7. 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.

Other reference chapters