Skip to content

Advanced Algorithms: rounds 1 to 7 of Build in iterations - #68

Merged
Asmaa6777 merged 28 commits into
STACK-42:mainfrom
Asmaa6777:main
Nov 6, 2026
Merged

Asmaa6777 merged 28 commits into
STACK-42:mainfrom
Asmaa6777:main

Conversation

@Asmaa6777

Copy link
Copy Markdown
Member

Part of #65.

Runs the Advanced Algorithms & Analysis course through rounds 2 to 7 of Build in iterations. Each module of each round is its own commit, so the PR can be reviewed commit by commit. The checklist and every round's full report (what changed, source errors, what was left out) are in docs/iterations/advanced-algorithms.md (new) and posted on #65.

Round Status
2. Source fidelity M0–M4
3. Depth M0–M4
4. Plain language M0–M4
5. Visualizations M0–M4
6. Practice M0–M4
7. Connections whole course
8. Student read-through not started (needs a fresh session)

Errors fixed in the lessons

  • m0-06: the growth-rate exercise listed n log n where the lab has n^(log n), so the given answer was wrong.
  • m0-02: the average case when the key may be missing left out the factor p.
  • m2-02: the stuck quadratic-probing example said 3 free slots; there are 4.
  • m3-03: both MST visualizers ran on a made-up graph; they now use the lecture's Prim example.

What each round added

  • Source fidelity: worked traces that existed only inside visualizers are now written out; the lecture's three red-black deletion examples; both names where the notes differ (Lomuto's partition, Gauss method / Karatsuba); slips in the slides and labs pointed out where a student holding them would be confused.
  • Depth: a common-mistake callout in every lesson, each counterexample checked by brute force, and the missing reasons filled in (insertion sort's best case, the base case of the binary-search proof, the red-black height induction step, the potential method's arithmetic).
  • Plain language: long sentences split, idioms and filler words removed. No change in content.
  • Visualizations:
    • a min-max merge mode for MinMaxVisualizer
    • a new VlsiLayouts diagram (obvious layout vs H-tree)
    • a new LoadFactorChart
    • directed edges and node labels in GraphTraversal, used for the lecture's BFS example
    • a new PvsNpDiagram
    • quicksort on equal keys
    • array cells now respect reduced motion
  • Practice: every lesson ends with Practice from past exams. Part 1 has midterm questions and Part 2 final-exam questions, drawn from 13 midterms and 12 finals. Multiple choice uses Quiz; written questions use a new ModelAnswer button that reveals the answer. Scanned questions (the 2023 Prim/Dijkstra MCQs and the 2018 MST, Dijkstra and robot questions) were rebuilt from the images, and every answer was recomputed.
  • Connections: 18 links to the lessons in Algorithm Design and Analysis, Discrete Mathematics and Data Structures that teach what these lessons use. On the tools page, the course is added to five tools, and there are two new tools: "Maps apps and internet routing" and "diff and Git".

Shared code touched

  • Quiz has a new practice prop. A practice quiz saves no score and doesn't mark the lesson complete, because otherwise two quizzes in one lesson would overwrite each other's score. Existing quizzes are unchanged, and a test checks they still save scores.
  • GraphSvg and GraphTraversal take an optional directed flag and show node labels. Algorithm Design and Analysis uses the defaults and looks the same; its tests pass.
  • .github/workflows/deploy.yml: the build job only runs in STACK-42/decoded. Before this, the Pages deploy failed on every push to a fork, because forks don't have Pages set up.
  • CLAUDE.md documents Quiz practice and ModelAnswer.

Tests

New tests cover:

  • the min-max merge mode
  • the VLSI layouts
  • the hash probe counts and load-factor curve
  • the lecture's MST graph and directed BFS order
  • the red-black deletion examples and two exam insertions
  • ModelAnswer and practice quizzes

npm run lint (0 errors), the course, link, tools and algorithm tests, and vite build pass. The 4 failures in lesson-preview.test.ts also fail on main without these changes.

Not done

  • No browser check of the new visualizers and practice sections. No browser automation is installed here, so phone width, dark mode and reduced motion were checked by reading the code.
  • Round 8 (student read-through) and round 9 (real readers).

Round 2 (source fidelity) for M0. Fix the lab's growth-rate problem,
which lists n^(log n), not n log n. Add the min-max merge trace with
the lab sheet's last row corrected, the insertion sort trace, the full
average case when the key may be missing, and the notes' 2n + 3 count.
Point out the lab code's slips and the two typos in the lecture code.
Tracks the Build in iterations rounds per module, with round 2's M0 report.
Round 2 (source fidelity) for M1. Write out the quicksort partition,
counting sort and radix sort traces that were only in the visualizers,
name Lomuto's partition and Karatsuba's algorithm, finish the select
example, and note the slide and lab slips. Tick M1 in the checklist.
Round 2 (source fidelity) for M2. Fix the free-slot count in the stuck
quadratic probing example and the probe-count claim in the hashing lab.
Add the lecture's three red-black deletion examples with a test that
checks their final trees, open-addressing rehashing, and the chaining
vs. open addressing comparison. Tick M2 in the checklist.
Round 2 (source fidelity) for M3. Run both MST visualizers on the
lecture's Prim graph, write out the lecture's directed BFS example,
the C(6, 3) and knapsack tables, and answer the two open greedy
exercises. Tests pin the MST orders and the BFS order. Tick M3.
Round 2 (source fidelity) for M4. Answer the 3-variable SAT and clique questions, note the slide's mismatched SAT table, and count distinct TSP tours. Round 2 is now complete.
Round 3 (depth) for M0: insertion sort's best case, where binary search's counts and fib's doubling come from, the base case of the binary search proof, and a common-mistake callout in every lesson.
Round 3 (depth) for M1: a worked Gauss multiplication, Strassen's saving in numbers, why equal keys and MSD-first radix sort hurt, and a common-mistake callout in each lesson.
Round 3 (depth) for M2: a worked mid-square hash, the potential method's arithmetic, the red-black height induction step, and a common-mistake callout in each lesson.
Round 3 (depth) for M3: counterexamples for greedy coin-row, wrong activity-selection rules and Dijkstra with a negative edge, plus subsequence vs. substring and the usual MST slips.
Round 3 (depth) for M4: why input length means digits (trial division is exponential), what NP does not mean, and which way a reduction goes. Round 3 is now complete.
Round 4 (plain language) for M0: split the long sentences, replace 'in terms of', and explain 'subroutine' and 'nondecreasing' where they first appear.
Round 4 (plain language) for M1: split the long sentences in all five lessons.

Part of STACK-42#65
Round 4 (plain language) for M2: split the long sentences in all seven lessons and drop filler words.

Part of STACK-42#65
Round 4 (plain language) for M3: split the long sentences in all five lessons, replace hedge words, and give the scheduling example's reasons once.

Part of STACK-42#65
Round 4 (plain language) for M4: split the long sentences and simplify the definition of a reduction. Round 4 is now complete.

Part of STACK-42#65
Round 5 (visualizations) for M0: MinMaxVisualizer gets a second mode for the lab's Algorithm 2, with a test. Array cells now honour reduced motion.

Part of STACK-42#65
Forks don't have GitHub Pages set up, so the deploy workflow's Setup Pages step failed on every push to a fork. Run the build job only in STACK-42/decoded; the deploy job depends on it and is skipped too.
Round 5 (visualizations) for M1: a new VlsiLayouts diagram compares the obvious tree layout with the H-tree, with a test, and the quicksort stepper runs on equal keys.

Part of STACK-42#65
Round 5 (visualizations) for M2: a LoadFactorChart compares 1/(1 - a) with 1 + a. The hashing lab points at the visualizer's probe counter again, with a test that it gives 16, 23 and 16.

Part of STACK-42#65
Round 5 (visualizations) for M3: GraphTraversal can draw directed edges with arrowheads and show node names in its messages, queue and order. The shortest-paths lesson runs it on the lecture's a to i graph.

Part of STACK-42#65
Round 5 (visualizations) for M4: a PvsNpDiagram toggles between P != NP and P = NP, with example problems in each class and NP-hard reaching outside NP. Round 5 is now complete.

Part of STACK-42#65
Round 6 (practice) for M0: every lesson ends with midterm questions (part 1) and final questions (part 2). Multiple choice uses Quiz, which gets a practice mode that saves nothing; written questions use a new ModelAnswer button.

Part of STACK-42#65
Round 6 (practice) for M1: midterm and final questions after every lesson, with model answers and practice quizzes.

Part of STACK-42#65
Round 6 (practice) for M2: midterm and final questions after every lesson, including the three hash-table exercises and the 2023 red-black insertion with a test.

Part of STACK-42#65
Round 6 (practice) for M3: midterm and final questions after every lesson, including the 2023 midterm's 16 Prim and Dijkstra questions rebuilt from the scan, and the 2018 final's MST, Dijkstra, Huffman, robot and red-black questions.

Part of STACK-42#65
Round 6 (practice) for M4: ten final-exam questions on P, NP and NP-completeness, plus coin-change and Dijkstra questions from the same finals in the greedy and shortest-path lessons. Round 6 is now complete.

Part of STACK-42#65
Round 7 (connections): 18 links from lessons to where their ideas are taught, the course added to five tools on the tools page, and two new tools (routing, diff and Git).

Part of STACK-42#65
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant