Free to read · Three levels

Data Structures and Algorithms: contracts, proofs, and tested implementations

A complete course in invariants, complexity, sequences, search, trees, heaps, graphs, dynamic programming, greedy proofs, dynamic ranges, string matching, and amortized analysis.

18 lessonsEnglish + ArabicContent reviewed
Start learning

In this course

Learn to specify an algorithm’s result, prove its maintained invariants, and choose a representation whose complete operation contract fits the task. Three levels contain six developed lessons each, with two explained standalone Python examples, diagnostic mistakes, worked exercises, and primary references.

Examples use synthetic in-memory values, graphs, intervals, and strings. The course separates asymptotic models, exact correctness outputs, finite differential evidence, and real implementation measurements. It does not operate services, databases, devices, cloud systems, or production workloads.

What you will learn

  • Specify invariants, duplicate policy, ownership, and cost models before selecting an algorithm.
  • Implement and validate sequence, hashing, search, sorting, tree, heap, and traversal contracts.
  • Choose shortest-path methods from their weight and reachability assumptions.
  • Derive dynamic-programming dependencies, greedy exchanges, and spanning-forest decisions.
  • Maintain dynamic range aggregates and overlapping string matches with explicit index semantics.
  • Distinguish amortized, expected, worst-case, output-sensitive, and measured performance claims.

Your learning path

Three levels

Who this is for

  • Programmers who know basic Python and want to reason about data structures and algorithms beyond memorized patterns.
  • Developers preparing to review correctness, resource bounds, and representation choices with concrete evidence.

Before you start

  • Functions, loops, lists, dictionaries, classes, and basic integer arithmetic in Python.
  • Comfort with simple inequalities, induction-style reasoning, and explicit input/output contracts. Examples require only a compatible Python3 interpreter and standard library.