Skip to main content

Course Overview

These lessons cover the theory of algorithmics: how to measure the cost of an algorithm, how to analyze it before running it, and the main strategies for designing efficient algorithms. They follow the Algorithmics course of the Software Engineering degree, but every lesson is self-contained: you can read them in order as a course, or jump to any topic as a reference.

The code of the examples, with tests and time measurements, is in the course repository vicegd/algorithms (Java).

How the lessons work​

  • Every claim about running times has been measured, and every example has been executed. Where a lesson gives a number of operations or a time, it is a real measurement, not an estimate.
  • Every numbered lesson opens with its estimated reading time, prerequisites, and a "What you will learn" objectives box, includes expandable 🧠 Checkpoint questions inline throughout the text (open them to see the answer), and closes with a Summary (or Key ideas), Practice prompts (or Self-check, intentionally provided without written solutions to encourage independent work and discussion in class or office hours), and Related lessons computed automatically by content similarity (TF-IDF).
  • Chapters end with a summary, an exercises page (with solutions grouped at the end), a proofs page (for chapters with formal correctness and complexity proofs), and a references page (matching textbook chapters, original papers, and online resources).
  • Mathematical notation is kept to what is needed: sums, logarithms and the asymptotic notation introduced in chapter 1. The mathematics behind it is explained in Appendix A.
  • The course is organized in parts: foundations, problem domains, design techniques and execution models. Every chapter follows the same structure so new chapters can be added to any part.

Interactive study tools​

  • Big-O Cheat Sheet: interactive complexity table covering the course algorithms, with paradigm and property filters (Stable, In-place, Optimal), sortable columns, and side-by-side comparison.
  • Knowledge Graph: interactive prerequisite map showing how chapters and lessons depend on one another, highlighted with your local completion state.
  • Flashcards: active-recall study deck covering core theory and every algorithm's complexity and trade-offs, with spaced repetition (Leitner boxes: each card you know comes back after 1, 2, 4, 8 and 16 days), a Due today view, paradigm filters and keyboard shortcuts. Progress is stored only in your browser.
  • Sandbox & Parallel Benchmark: run JavaScript vs. WebAssembly (.wasm) inside an isolated Web Worker sandbox with watchdog timeout, and measure real multi-core speedup vs. Amdahl's Law across your CPU threads.
  • Glossary: concise definitions of the main course terms, each linked to the lesson where it is explained.
  • Study progress, streak & badges: mark lessons as completed at the bottom of any page (stored only in your browser, no account required) to track your daily study streak, unlock chapter mastery badges, get explainable next-lesson recommendations on the home page, and export a visual SVG / verifiable JSON progress badge.
  • Audio narration (πŸ”Š Listen to lesson): listen to any lesson directly in the browser with spoken math formulas, segment seek controls, and adjustable speed (0.75×–1.5Γ—).
  • Typo-tolerant search & offline PWA: press Ctrl+K (or /) from any page to search the entire course (tolerant to typos), and install the site to your mobile or desktop home screen for offline reading of visited lessons.

Part I. Foundations​

1. Principles of Algorithmics​

What an algorithm is, and the tools to measure and analyze its cost.

  1. Algorithmic Thinking: what an algorithm is, where the word comes from, and why we study algorithm design.
  2. Case Study: Maximum Pairwise Product: one problem solved in several ways, from quadratic to linear.
  3. Data Structures: arrays, the Java collections, graphs and trees.
  4. Measuring Efficiency: how to take reliable time measurements, and their limits.
  5. Complexity Analysis: counting operations; best, worst and average case.
  6. Asymptotic Notation: big O, Omega and Theta.
  7. Growth Rates and Predictions: complexity classes and predicting times.
  8. Complexity of Loops: analyzing iterative code.
  9. Case Studies: Searching: sequential search, the sentinel, and binary search.
  10. Summary: the key ideas and an overview table of the chapter.
  11. Exercises: 16 exercises, with solutions.
  12. Proofs: formal correctness and cost proofs.
  13. References: readings, textbooks and original papers.

Part II. Problem Domains​

2. Sorting​

One of the most studied problems in computing.

  1. The Sorting Problem
  2. Bubble Sort
  3. Insertion Sort
  4. Selection Sort
  5. Quicksort
  6. Beyond Quadratic Sorting: Mergesort, the nlog⁑nn \log n limit and what real libraries use.
  7. Comparing Sorting Algorithms: choosing an algorithm in practice.
  8. Summary: the key ideas and an overview table of the chapter.
  9. Exercises: 16 exercises, with solutions.
  10. Proofs: correctness, bounds and lower-bound proofs.
  11. References: readings, textbooks and original papers.

Part III. Design Techniques​

3. Brute Force​

  1. Brute Force and Exhaustive Search: the most direct way to solve a problem, and the reference for every other technique.
  2. Summary: the key ideas and an overview table of the chapter.
  3. Exercises: 5 exercises, with solutions.
  4. References: readings, textbooks and original papers.

4. Divide and Conquer​

  1. The Divide and Conquer Scheme
  2. Analyzing Divide and Conquer: recurrences by subtraction and by division.
  3. Numbers and Searches: factorial, searches, Fibonacci and the greatest common divisor.
  4. Classic Problems: Mergesort, Quicksort, the towers of Hanoi, large integers, tournaments and trominoes.
  5. Majority, Mode and Median
  6. Summary: the key ideas and an overview table of the chapter.
  7. Exercises: 8 exercises, with solutions.
  8. Proofs: correctness and recurrence proofs.
  9. References: readings, textbooks and original papers.

5. Greedy Algorithms​

  1. The Greedy Method
  2. Classic Problems: files on a disk, the knapsack, the plumber, the knight's tour, assignment, coloring, and the minimum spanning trees of Prim and Kruskal.
  3. Summary: the key ideas and an overview table of the chapter.
  4. Exercises: 9 exercises, with solutions.
  5. Proofs: greedy-choice and optimality proofs.
  6. References: readings, textbooks and original papers.

6. Dynamic Programming​

  1. The Dynamic Programming Method
  2. Classic Problems: binomial coefficients, knapsack, change, the river, LCS and edit distance.
  3. Summary: the key ideas and an overview table of the chapter.
  4. Exercises: 10 exercises, with solutions.
  5. Proofs: optimal substructure and cost proofs.
  6. References: readings, textbooks and original papers.

7. Backtracking​

  1. The Backtracking Scheme
  2. Classic Problems: permutations, subset sum, N-queens, the knight's tour, coloring, assignment, magic squares and Sudoku.
  3. Summary: the key ideas and an overview table of the chapter.
  4. Exercises: 5 exercises, with solutions.
  5. Proofs: pruning soundness and search-tree bounds.
  6. References: readings, textbooks and original papers.

8. Branch and Bound​

  1. The Branch and Bound Scheme
  2. Classic Problems: assignment, knapsack, sliding puzzles, rectangle placement, N-queens and the traveling salesman.
  3. Summary: the key ideas and an overview table of the chapter.
  4. Exercises: 6 exercises, with solutions.
  5. Proofs: bound admissibility and optimality proofs.
  6. References: readings, textbooks and original papers.

Choosing a Technique​

  1. Choosing a Design Technique: the 0/1 knapsack solved with the six techniques, the change problem and Fibonacci, and a guide to choose a technique for a new problem.

Part IV. Execution Models​

9. Parallel Algorithms​

  1. Concurrency and Parallelism
  2. The Fork/Join Framework
  3. Performance of Parallel Algorithms: speedup, efficiency and Amdahl's law.
  4. Summary: the key ideas and an overview table of the chapter.
  5. Exercises: 9 exercises, with solutions.
  6. Proofs: work/span and speedup proofs.
  7. References: readings, textbooks and original papers.

Appendices​

A. Mathematical Background​

A reference for the mathematics used in the chapters, with the reasons behind each fact.

  1. Sums, Logarithms and Factorials: arithmetic, geometric and harmonic series, logarithm rules, Stirling's formula.
  2. Induction, Correctness and Recurrences: induction, loop invariants, and four ways to solve recurrences.
  3. Summary: the key ideas and an overview table of the chapter.
  4. Exercises: 12 exercises, with solutions.
  5. References: readings and mathematical references.

The Glossary collects the main terms of the course, each with a short definition and a link to the lesson where it is explained.

Suggested order​

Chapters 1 and 2 are the base for everything else: read them first and in order. The design techniques of Part III can then be read in order, since each one compares itself with the previous ones: brute force is the reference, and backtracking and branch and bound refine it. The lesson Choosing a Design Technique closes Part III by comparing all of them on the same problems. Parallel algorithms (chapter 9) only need divide and conquer, so they can be read right after chapter 4. Appendix A is a reference: consult it whenever a lesson relies on a sum, a logarithm or a recurrence, or read it alongside chapter 1.

Questions, or something wrong?

Errors, suggestions and public questions open a form on GitHub, visible to everyone.