Skip to content
Volume 2

Data Structures & Algorithms

Give your code a super-powered brain — from Big O to advanced data structures,
implement every core structure by hand in Java/Python/C++.

** Prerequisites**

Requires programming fundamentals (complete Volume 1). Familiarity with Java/Python basic syntax.

Chapter 1 Algorithm Complexity Analysis Complete

What do O/Ω/Θ really mean? Trading time for space, trading space for time, the actual cost of each operation in Java/Python.

Chapter 2 Arrays and Linked Lists Complete

ArrayList vs LinkedList — the hidden pitfalls of insert/delete. Hand-write doubly linked lists (singly·doubly·circular).

Chapter 3 Stacks, Queues and Deques Complete

Use stacks for bracket matching and expression evaluation, circular queues. Deque — the combined form of stack and queue. Monotonic stack/queue.

Chapter 4 Hash Tables Complete

HashMap internals: hash functions·separate chaining·open addressing·rehashing. The hashCode/equals contract, designing good hash functions.

Chapter 5 Binary Trees and Binary Search Trees Complete

Pre/in/post/level-order traversal (recursive+iterative). BST insert/delete/search, in-order is sorted. TreeSet/TreeMap under the hood.

Chapter 6 Balanced Trees and Red-Black Trees Complete

AVL four rotations. The five rules of red-black trees broken down step by step, the full insert/delete coloring rotation process. Why TreeMap uses red-black trees instead of AVL.

Chapter 7 Heaps and Priority Queues Complete

Binary heap array representation, sift-up/sift-down, building a heap in O(n). Heap sort, Top-K, merging K sorted lists. PriorityQueue source code.

Chapter 8 Graphs Complete

Adjacency list/matrix, BFS/DFS templates and connected components, topological sort (Kahn + DFS). Shortest path Dijkstra, minimum spanning tree Prim/Kruskal.

Chapter 9 Sorting Algorithms (Part 1) Complete

Bubble/Selection/Insertion — the O(n²) trio + Shell sort. Which one does Java actually use? Why doesn't Python use them?

Chapter 10 Sorting Algorithms (Part 2) Complete

Merge/Quick/Heap sort — the O(n log n) triangle. Quick sort degradation, merge space overhead, heap sort instability. Engineering implementations: dual-pivot quicksort, Timsort. Counting/Bucket/Radix sort.

Chapter 11 Search Algorithms and String Matching Complete

Binary search and its variants. Interpolation search. KMP (hand-trace the next array + code). Rabin-Karp and hash collisions.

Chapter 12 Divide and Conquer & Backtracking Complete

The three steps of divide-and-conquer: divide → conquer → combine. Backtracking framework: make choice → recurse → undo. N-Queens, permutations, subset generation.

Chapter 13 Dynamic Programming Complete

From recursion → memoization → DP table derivation. 0-1 Knapsack / Unbounded Knapsack, LCS/LIS, interval DP. State transition equations aren't magic.

Chapter 14 Greedy Algorithms Complete

Interval scheduling, Huffman coding, Huffman trees. Greedy vs DP — when can you cut corners?

Chapter 14+ Reductions and NP-Completeness Complete

The idea of reduction, P vs NP, NPC problems and reduction chains, engineering practice: what to do when you encounter an NPC problem.

Chapter 14+ Amortized Analysis Complete

Aggregate/potential/accounting methods, dynamic array resizing, binomial heap concurrency, amortized analysis of union-find and splay trees.

Chapter 15 Advanced Data Structures Complete

Union-Find (path compression + union by rank), Skip Lists (Redis ZSet kernel), Bloom Filters (false positive rate derivation), Tries (Trie and autocompletion), Segment Trees (end-to-end range query implementation).

This volume has 17 chapters (including 2 bonus chapters), Complete

Built with VitePress | Software Systems Atlas