Data structures and algorithmsCHAPTER 01
PART A / Data structures and algorithms
Step 2 of 252
CHAPTER 01GUIDED READING

Data structures and algorithms

Choose structures, trace their state, and defend time and memory costs.

Learn what each structure remembers

A set remembers which IDs have appeared. A queue remembers which task comes next. A heap keeps the next priority available without sorting everything again. This chapter makes those differences visible with small inputs and state traces before asking you to solve a full problem.

Read the structures in order, trace each operation by hand, and name the invariant that remains true. You are learning to choose a tool and account for time and memory. The next chapter combines those tools into complete solutions.

Parts group related chapters. Each lesson has a chapter.lesson address, such as 4.07. Open a title below, or use Next to follow the reading sequence. Within a lesson, On this page lists its sections.

  1. 1.01

    Cost: count the work and the memory

    Cost and basic collections

  2. 1.02
  3. 1.03

    Sets: remember membership

    Cost and basic collections

  4. 1.04

    Maps: remember earlier work

    Cost and basic collections

  5. 1.05

    Stacks: keep unresolved work

    Order and linked structures

  6. 1.06

    Queues and deques: control who goes next

    Order and linked structures

  7. 1.07
  8. 1.08
  9. 1.09

    Heaps: keep the next best candidate

    Order and linked structures

  10. 1.10
  11. 1.11
  12. 1.12
  13. 1.13
  14. 1.14

    Sorting: pay once to expose order

    Algorithms that narrow the work

  15. 1.15

    Sorted data: binary search and intervals

    Algorithms that narrow the work

  16. 1.16

    Two pointers: discard work with a reason

    Algorithms that narrow the work

  17. 1.17

    Windows: move boundaries, avoid rescanning

    Algorithms that narrow the work

  18. 1.18

    Prefix sums: count possible starts

    Algorithms that narrow the work

  19. 1.19

    Greedy choices: prove the local step is safe

    Algorithms that narrow the work

  20. 1.20

    Search: choose, recurse, undo

    Search, reuse, and selection

  21. 1.21
  22. 1.22
  23. 1.23