Data structures and algorithms
Learn to choose data structures and explain algorithm correctness and cost.
Get an in-app notice when new lessons or practice are added.
21 chapters across 6 modules
Course chapters
Explore all 21 chapters in any order. Each chapter has learning goals, a practice prompt, and a primary reference; expanded reading pages are linked from their chapter titles.
No matching chapters. Try another term.
01 · Reasoning foundations4 chapters
Inputs, outputs, and correctness
- Write a precise problem contract and identify invariants
Practice: Specify duplicate handling for a search function.
Read the primary referenceLesson guide · ReadyTime and space complexity
- Describe growth rates without treating them as exact timings
Practice: Compare two ways to detect duplicates.
Read the primary referenceLesson guide · ReadyArrays and linked lists
- Compare contiguous storage, indexing, and structural updates
Practice: Choose a representation for a queue workload.
Read the primary referenceLesson guide · ReadyStacks and queues
- Apply last-in-first-out and first-in-first-out behavior
Practice: Check balanced parentheses using a stack.
Read the primary referenceLesson guide · Ready
02 · Searching and sorting4 chapters
Linear and binary search
- State binary-search ordering and boundary invariants
Practice: Find the first position of a value with duplicates.
Read the primary referenceLesson guide · ReadyElementary sorting
- Trace insertion and selection sort behavior
Practice: Compare swaps and comparisons on nearly sorted input.
Read the primary referenceLesson guide · ReadyMerge sort and divide-and-conquer
- Explain recursive decomposition and merging
Practice: Implement a merge and test empty inputs.
Read the primary referenceLesson guide · ReadyHash tables
- Explain hashing, collisions, and expected lookup cost
Practice: Build a frequency table and discuss adversarial cases.
Read the primary referenceLesson guide · Ready
03 · Trees and graphs4 chapters
Trees and traversal
- Distinguish tree shape and traversal order
Practice: Traverse a small directory-like tree.
Read the primary referenceLesson guide · ReadyHeaps and priority queues
- Maintain an extremum through a heap invariant
Practice: Select the next task by priority.
Read the primary referenceLesson guide · ReadyGraph representations
- Choose an adjacency representation for a graph workload
Practice: Model a course-prerequisite graph.
Read the primary referenceLesson guide · ReadyBFS and DFS
- Explain visitation state and traversal guarantees
Practice: Find reachability and an unweighted shortest path.
Read the primary referenceLesson guide · Ready
04 · Problem-solving patterns4 chapters
Recursion and backtracking
- Identify base cases and restore state during exploration
Practice: Generate small combinations without duplicate outputs.
Read the primary referenceLesson guide · ReadyGreedy reasoning
- Explain when a local choice needs a correctness argument
Practice: Test a greedy scheduling rule against counterexamples.
Read the primary referenceLesson guide · ReadyDynamic programming
- Identify repeated subproblems and define state transitions
Practice: Solve a small counting problem with memoization.
Read the primary referenceLesson guide · ReadyMini project: route explorer
- Combine graph modeling, search, and complexity analysis
Practice: Build a tiny path-finding tool with a correctness explanation.
Read the primary referenceLesson guide · Ready
05 · Algorithmic extensions4 chapters
Shortest paths with weights
- Explain why an unweighted traversal is insufficient for general weights
Practice: Compare path choices on a small positive-weight graph.
Read the primary referenceLesson guide · ReadyTopological ordering
- Connect dependency ordering to acyclic directed graphs
Practice: Order a small curriculum prerequisite graph and detect a cycle.
Read the primary referenceLesson guide · ReadyUnion-find
- Use disjoint-set operations to track connectivity
Practice: Process a sequence of connections and answer component-membership queries.
Read the primary referenceLesson guide · ReadyProperty-based reasoning
- State properties that should hold across many inputs
Practice: Design invariants for a sorting implementation and seek counterexamples.
Read the primary referenceLesson guide · Ready
06 · Further foundations and worked reasoning1 chapter
Cost and invariants
Use a small search problem to connect correctness with growing input size.
- State an invariant and a cost model before choosing an implementation
Practice: Compare two search strategies and trace the invariant on empty and nonempty inputs.
Read the primary referenceExpanded reading · Ready
Learn it. Check it. Try again.
14 original questions with worked explanations and source references. Filter by difficulty, revisit mistakes, and save your attempt as you go.
Open Data structures and algorithms practiceBooks & references
Free reading at the publisher or author’s site. External materials keep their own licenses.
- Open Data StructuresPat Morin · book
Source & reuse terms
Author page permits reuse under CC BY 2.5 Canada. Preserve author credit, license and notices if a local copy is later added.
Publisher’s terms - Composing ProgramsJohn DeNero and contributors · book
Source & reuse terms
Author site states CC BY-NC-SA 4.0. This catalog links to the author edition without copying its chapters.
Publisher’s terms - Introduction to Algorithms, 6.006MIT OpenCourseWare · course
Source & reuse terms
MIT OCW terms state CC BY-NC-SA 4.0 with exclusions for separately credited material. Link to the course; check each asset before reuse.
Publisher’s terms