Table of contents

The Curriculum

Nine lessons across five chapters. Read them in order if you are new, or dip in where you need to. Every lesson is self-contained and includes runnable code.

05

Data Structures in Java

§ 6.01
Arrays and ArrayList — the workhorses
Fixed-size arrays vs dynamic ArrayList. Memory layout, amortized O(1) append, and when each one shines.
22 min
§ 6.02
LinkedList and the Deque interface
Doubly-linked nodes, O(1) insert at either end, and why LinkedList is almost never the right choice.
20 min
§ 6.03
Stacks, queues, and ArrayDeque
LIFO, FIFO, and why java.util.Stack is a historical mistake you should avoid.
24 min
§ 6.04
HashMap, equals, and hashCode
How hashing works, why you must override equals and hashCode together, and the load factor that keeps lookups O(1).
28 min
§ 6.05
TreeMap, TreeSet, and ordered structures
Red-black trees under the hood. O(log n) sorted access, range queries, and floor/ceiling lookups.
26 min
§ 6.06
PriorityQueue — heaps in disguise
Binary heaps, O(log n) insert and extract-min, and the canonical k-largest pattern.
22 min
§ 6.07
Graphs — adjacency lists and BFS
Modeling graphs in plain Java with Map<Node, List<Node>>, then walking them breadth-first.
30 min
§ 6.08
HashSet and LinkedHashMap — uniqueness and order
Deduping in O(1), preserving insertion order, and building an LRU cache in 6 lines.
22 min
§ 6.09
Binary Search Trees from scratch
Build a BST, understand insert and search, and see why balance is everything.
28 min
§ 6.10
Tries — prefix search and autocomplete
A tree keyed by character. Autocomplete, spellcheck, and IP routing tables all live here.
26 min
§ 6.11
Union-Find (Disjoint Set)
Track connected components in near-constant time with path compression and union by rank.
24 min
§ 6.12
Immutable and unmodifiable collections
List.of, Map.copyOf, Collections.unmodifiableList — knowing which is which prevents subtle bugs.
18 min