← All courses

Course / 12 modules

Data Structures and Algorithms, Pattern by Pattern

A twelve-module course on the patterns behind most algorithm problems, from Big O to dynamic programming, measured in TypeScript on Node.js.

After this course, you can

  • State the time and memory cost of a solution before you write it, and read input limits to know the cost you need
  • Turn a slow nested loop into a faster solution with two pointers, a sliding window, a prefix sum or a hash map
  • Pick and write the right structure: a linked list, a stack, a queue, a tree, a graph or a heap
  • Solve search problems with binary search, greedy choices, backtracking and dynamic programming
  • Choose the pattern for a new problem with a repeatable method, and explain your choice out loud

The course is free.

Who it is for

Developers who can code but may be new to algorithms. You use arrays, maps and sorting, but you haven’t practiced naming an algorithm’s cost or spotting which pattern a problem needs. Every term is explained where it first appears.

  • You should already read TypeScript: generics, classes and closures
  • It covers about fifteen patterns. Each module’s “Going deeper” section shows how its structures work underneath in JavaScript and V8, and you can skip it
  • It leaves out formal proofs, balanced-tree internals, advanced graph and string algorithms, and competitive-programming tricks

How it works

  • Each module opens with a slow solution you can run, measures it, then replaces it with the pattern and measures again
  • Each module ends with exercises that have tests, hidden answers and a cheat sheet
  • The last module puts every pattern together in one method for choosing between them
  • You need Node.js and a text editor; TypeScript runs directly in Node.js, with no packages to install
  • Code for every module, with the exercises and their solutions, in github.com/vespaiach/data-structure-algorithms

Outline

12 modules, read in order