Data structures & algorithms

Learn to reason about performance, follow how data changes, and compare Python, Java, and JavaScript implementations.

Beginner

Intermediate

Singly linked lists

Follow a chain of nodes and understand which updates are cheap when you have the right reference.

Intermediate 15 min

Hash maps and counting

Count values in one pass by storing a lookup table of items already seen.

Intermediate 14 min

Recursion and tree traversal

Visit tree branches with smaller calls and identify what stops each branch.

Intermediate 16 min

Breadth-first search

Explore an unweighted graph layer by layer and follow the queue as it changes.

Intermediate 16 min

Depth-first search

Explore one graph branch at a time and prevent a cycle from repeating your work.

Intermediate 16 min

Backtracking with choices

Build a candidate one choice at a time and restore the previous state after exploring each branch.

Intermediate 16 min

Merge sort

Merge sort splits a list into smaller parts, sorts each part, and merges the sorted parts.

Intermediate 8 min

Quicksort and partitioning

Quicksort groups elements around a pivot and sorts the remaining groups separately.

Intermediate 8 min

Heaps and priority queues

A priority queue gives you the next item by priority, and a binary heap is one way to store it.

Intermediate 8 min

Binary search trees

A binary search tree stores smaller keys on the left and larger keys on the right, with an explicit rule for duplicates.

Intermediate 8 min

Algorithm invariants

An invariant is a condition that remains true at a known point in each step of an algorithm.

Intermediate 8 min

Adjacency lists and matrices

A graph can store each vertex’s neighbors as a list or record every possible connection in a matrix.

Intermediate 8 min

Counting sort

Counting sort tracks how often each key occurs and then visits the keys in order.

Intermediate 8 min

Advanced

Dijkstra’s shortest paths

Find minimum-cost paths when edges have different nonnegative weights.

Advanced 20 min

Dynamic programming

Build a table of useful subproblem answers, then use it to count staircase paths.

Advanced 18 min

Tries and prefix search

A trie stores words by sharing the path for their common starting letters.

Advanced 12 min

Union-find and connected groups

Union-find keeps track of which items are in the same group as groups are joined.

Advanced 12 min

Topological sorting

A topological order puts each prerequisite before the work that requires it.

Advanced 12 min

Greedy interval scheduling

A greedy strategy makes a locally chosen move, and it works only when that move can be justified.

Advanced 12 min

Minimum spanning trees

A minimum spanning tree connects every vertex in a weighted undirected graph with the smallest possible total cost.

Advanced 12 min

Bellman–Ford and negative edges

Bellman–Ford finds shortest paths by repeatedly checking whether any edge improves a known distance.

Advanced 12 min

0/1 knapsack

Knapsack asks you to pick items with the highest total value while staying under a capacity.

Advanced 12 min

Longest common subsequence

A common subsequence appears in both strings in the same order and can skip characters.

Advanced 12 min

Fenwick trees and dynamic prefix sums

A Fenwick tree answers prefix-sum queries quickly while allowing individual values to change.

Advanced 12 min

Segment trees and range queries

A segment tree stores summaries for ranges so a query can combine only the pieces it needs.

Advanced 12 min

Monotonic stacks

A monotonic stack keeps its pending values in order so later values can resolve several at once.

Advanced 12 min