DSA Fundamentals
data structures and algorithms from first principles โ starting with how memory works and building up from there. arrays, linked lists, trees, graphs, heaps, hash tables, sorting, and searching, explained with the depth that helps you understand why things are fast or slow, not just what to memorize.

Foundations
- 01
Introduction
freewhat data structures are, why they matter for writing fast code, and how this book builds your understanding from memory up
- 02
Seek into the Memory
freehow memory works as a giant array of bytes, why cache hierarchy decides performance, and how to think about data layout before choosing any structure
Arrays
- 03
Static Arrays
freehow to use contiguous memory for O(1) index access, why static arrays are the foundation of every other structure, and what tradeoffs they force
- 04
Dynamic Arrays
freehow to grow arrays on demand, why doubling capacity beats incrementing, and how amortized analysis explains the real cost behind slices and vectors
Linear Structures
- 05
Stacks
freehow to implement a stack, why every function call uses one, and how LIFO drives recursion and expression parsing
- 06
Singly Linked Lists
freehow to build a linked list with pointer surgery, when to choose it over arrays despite cache locality tradeoffs, and what Rust's ownership model reveals about list semantics
- 07
Doubly Linked Lists
voyagehow to implement bidirectional traversal, build an LRU cache with a doubly linked list, and why shared ownership makes this structure tricky in Rust
- 08
Queues
freehow to implement queues with circular buffers, why FIFO ordering matters, and how this structure powers every job processing system you've used
Recursion
- 09
Factorial
freehow to think recursively by building factorial step by step, trace the call stack to see what actually happens, and identify base cases vs recursive cases
- 10
Fibonacci Sequence
freewhy naive fibonacci explodes exponentially, how to fix it with memoization, and how this connects to dynamic programming
Sorting
- 11
Insertion Sort
freehow to implement insertion sort, why it outperforms complex algorithms on small or nearly-sorted data, and why real libraries still use it
- 12
Merge Sort
freehow to implement merge sort with divide and conquer, why it guarantees O(n log n), and when to choose stable sorting over in-place alternatives
- 13
Quick Sort
voyagehow to partition around a pivot, choose pivot strategies to avoid worst-case O(n^2), and why cache efficiency makes quicksort the default in most libraries
- 14
Bucket Sort
voyagehow to break the O(n log n) comparison barrier, sort in linear time when you know your data's distribution, and when bucket sort beats comparison-based algorithms
Binary Search
- 15
Search Array
freehow to implement binary search correctly, what O(log n) really means, and how to avoid the off-by-one errors that trip up even experienced developers
- 16
Search Range
voyagehow to use binary search beyond exact matches, find lower and upper bounds, and apply the generalized predicate pattern to boundary problems
Trees
- 17
Binary Tree
freehow to represent hierarchical data in memory, understand tree terminology, and see why Rust's ownership model maps naturally to tree structures
- 18
Depth-First Search
freehow to traverse trees with preorder, inorder, and postorder, when to pick each one, and how to convert between recursive and iterative implementations
- 19
Breadth-First Search
freehow to explore trees level by level using a queue, find shortest paths in unweighted structures, and recognize when BFS beats DFS
- 20
BST Sets and Maps
voyagehow to implement ordered sets and maps using the BST property, handle insert and delete correctly, and use range queries for efficient lookups
Heaps
- 21
Min Heap / Max Heap
voyagehow to store a complete binary tree as an array, implement bubble up/down operations, build a heap in O(n), and use it for heap sort
- 22
Priority Queue
voyagehow to implement a priority queue backed by a heap in Go, Rust, and C, and why it powers Dijkstra's algorithm, task scheduling, and stream merging
Hashing
- 23
Hash Tables
freehow to build a hash table from scratch, pick a hash function, handle collisions with chaining, and manage load factors for automatic resizing
- 24
Hash Sets & Collision Handling
voyagehow to implement open addressing with linear probing and Robin Hood hashing, and how to choose between chaining and probing based on cache behavior
Graphs
- 25
Intro to Graphs
freewhat graphs are, how to represent them with adjacency lists vs matrices, and why Rust's ownership model makes graph structures uniquely challenging
- 26
Graph BFS
voyagehow to find shortest paths in unweighted graphs using queue-based BFS, run multi-source exploration, and identify connected components
- 27
Graph DFS
voyagehow to detect cycles, produce topological orderings, and find connected components using recursive and iterative DFS on adjacency lists
- 28
Dijkstra's Algorithm
voyagehow to find shortest paths in weighted graphs using a greedy min-heap approach, trace the algorithm step by step, and understand why negative edges break it
Bit Manipulation
- 29
Bits and Binary
freewhat binary representation is, how two's complement encodes negative numbers, why endianness matters, and how to count set bits at the lowest level
- 30
Bitwise Operations
voyagehow to use AND, OR, XOR, NOT, and shifts to build permissions, feature flags, and protocol headers with practical bit manipulation patterns