← Courses
🧠

Documentation Course

Data Structures and Algorithms In-Depth

From First Principles to Architect-Level Systems Thinking

Start Reading

A complete A-Z data structures and algorithms curriculum for full-stack engineers — every concept anchored to the Node.js, TypeScript, Next.js, PostgreSQL, MongoDB, and Redis stack you already ship in production. From Big-O and hash maps for beginners through trees, graphs, and dynamic programming for mid-level engineers to heaps, Union-Find, shortest paths, and NP-completeness for senior engineers preparing for interviews and system design.

JJS
Written by Jatin Jain Saraf · Senior Software Engineer
Free41 modulesBeginner to AdvancedWritten / Documentation-style41 of 41 modules live

How to use this course

This course works as both a sequential read and a standalone reference. Read front-to-back to build a complete mental model from Big-O to NP-completeness. Or jump to any module when you need it — a specific interview pattern, a system design intuition check, or a refresher before a coding round.

Total reading time

~11 hrs

across 41 modules

Built from

Node.js, TypeScript, Next.js

Postgres, MongoDB, Redis anchors

Prerequisite

Zero DSA to interview-ready

Beginner through senior full-stack engineer

Phase 1 — Foundation

Absolute basics · No prior knowledge assumed

12 modules
F-1
Big-O Notation: Time and Space Complexity
Time and space complexity as production cost — Big-O notation, best/average/worst case, and how to spot O(n²) before it ships.
F-2
Arrays: Memory and Access Patterns
Why array indexing is O(1), insertion/deletion costs, and the array-based patterns — reversal, flattening, subarrays — you'll reuse everywhere.
F-3
Strings: Immutability and Manipulation Patterns
String immutability in JavaScript, why repeated concatenation kills performance, and substring/rotation patterns.
F-4
Hash Maps: Hashing, Collisions, and O(1) Lookups
How hash tables resolve collisions, Map vs Object, and the lookup patterns behind caching, deduplication, and memoization.
F-5
Bit Manipulation: Flags, Permissions, and Fast Math
AND/OR/XOR/shift operations, bit flags for permissions and feature toggles, and fast arithmetic tricks.
F-6
Stacks: LIFO, the Call Stack, and Expression Parsing
LIFO structure, the call stack, and balanced-bracket and expression-parsing patterns.
F-7
Queues: FIFO, Circular Queues, and Job Scheduling
FIFO structure, circular queues, and the queueing patterns behind message brokers and job schedulers.
F-8
Two-Pointer Technique
Converging and fast/slow pointer patterns that turn O(n²) nested loops into O(n) passes.
F-9
Sliding Window Pattern
Expanding and contracting windows for substring/subarray constraint problems, without recomputation.
F-10
Intervals and Line Sweep
Merging overlapping intervals, meeting-room scheduling, and sweeping sorted events in one pass.
F-11
Binary Search and Its Variants
O(log n) search and its variants — first/last occurrence, rotated arrays, and peak finding.
F-12
Capstone: DSA in Production — The Node.js Event Loop, Call Stack, and Queues
How the Node.js Event Loop is built from queues, and how the call stack you just learned governs every stack overflow you have seen.

Phase 2 — Practitioner

Production patterns · Real application architecture

16 modules
P-1
Recursion and the Call Stack
Base case vs recursive case, how the call stack unwinds, and when recursion beats — or loses to — iteration.
P-2
Linked Lists: Singly, Doubly, and Core Operations
Node-based structures, singly vs doubly linked lists, and the reversal/cycle-detection operations every list problem builds on.
P-3
The LRU Cache: Hash Map + Doubly Linked List for O(1) Access
Combining a hash map with a doubly linked list for O(1) reads and writes — the exact structure behind Redis-style cache eviction.
P-4
Tree Traversal: Inorder, Preorder, Postorder, and Level-order
All four traversal patterns, recursive and iterative, and where each one shows up in real rendering pipelines.
P-5
Binary Search Trees: Insert, Search, Delete, and Validation
Binary search tree invariants, insert/search/delete, and why balance is the difference between O(log n) and O(n).
P-6
Introduction to Graphs: Representation and Terminology
Adjacency list vs matrix, directed vs undirected, weighted vs unweighted — the vocabulary every graph algorithm assumes you already know.
P-7
Backtracking: Exploring the Solution Space
Systematic exploration with pruning — permutations, subsets, and constraint-satisfaction problems like N-Queens.
P-8
Sorting I: O(n²) Sorts and Why They're Slow
Bubble, selection, and insertion sort — why they're O(n²), and why understanding them still matters.
P-9
Sorting II: Merge Sort and Divide-and-Conquer
Merge sort, divide-and-conquer, and the stability guarantee that makes it the default for correctness-critical sorts.
P-10
Sorting III: Quick Sort and Partitioning
Quick sort, partitioning, and pivot selection — the in-place O(n log n) sort most languages actually ship.
P-11
Dynamic Programming I: Memoization and Tabulation
What dynamic programming actually is — memoization, tabulation, and the space/time trade-off, built from Fibonacci up.
P-12
Dynamic Programming II: Classic 1D Problems
House robber, coin change, decode ways — and how to define what dp[i] actually represents.
P-13
Dynamic Programming III: 2D DP and Knapsack
When state needs two dimensions, and how 0/1 knapsack differs from unbounded knapsack.
P-14
Dynamic Programming IV: LCS, LIS, Edit Distance, and Matrix Paths
Longest common subsequence, longest increasing subsequence, edit distance, and matrix path problems.
P-15
Greedy Algorithms: Local vs Global Optimum
When the locally optimal choice is also globally optimal — and the counterexamples that prove greedy isn't always safe.
P-16
Capstone: DSA in Production — React's Virtual DOM, Diffing, and Tree Traversal
How React's Virtual DOM is a tree, and how its diffing algorithm is DFS with a few production-grade shortcuts.

Phase 3 — Architect

Engine internals · High-throughput systems · Distributed architecture

13 modules
A-1
Heaps: Min-Heap, Max-Heap, and Heapify
Min-heap and max-heap structure, heapify, and O(log n) insertion/extraction as a priority queue.
A-2
Heap Applications: Heap Sort, Kth Largest, Merge K Sorted Lists
Heap sort, Kth largest element, and merging K sorted lists — where a heap beats a full sort.
A-3
Union-Find: Path Compression and Union by Rank
Disjoint set union with path compression and union by rank — near-O(1) connectivity tracking.
A-4
Graph Traversal: Depth-First Search (DFS)
Depth-first traversal, recursive and iterative, and the visited-set discipline that prevents infinite loops on cyclic graphs.
A-5
Graph Traversal: Breadth-First Search (BFS)
Breadth-first traversal, queue-based level exploration, and shortest-path-in-hops problems.
A-6
Shortest Paths I: Dijkstra's Algorithm
Single-source shortest path with a min-heap — the algorithm behind every non-negative-weight routing problem.
A-7
Shortest Paths II: Bellman-Ford and Floyd-Warshall
Handling negative weights, detecting negative cycles, and all-pairs shortest paths.
A-8
Topological Sort: Kahn's Algorithm and DFS-Based Ordering
Linear ordering of a DAG — Kahn's algorithm, DFS post-order, and cycle detection in directed graphs.
A-9
Grid Traversal Patterns: Flood Fill and Multi-Source BFS
Grids as implicit graphs — flood fill, multi-source BFS, and the 4/8-directional patterns behind island-counting and rot-spreading problems.
A-10
Tries: Prefix Trees and Autocomplete
Prefix trees for O(L) lookups — autocomplete, wildcard search, and why a trie beats a hash map for prefix queries.
A-11
String Matching: Rabin-Karp and KMP
Rabin-Karp rolling hashes and KMP's failure function — finding a pattern in a text faster than brute force.
A-12
P vs NP: Recognizing Intractable Problems
Why some problems have no fast solution — P, NP, NP-Complete, and how production systems cope with intractability.
A-13
Capstone: DSA in Production — Postgres B-Trees, MongoDB Geospatial, and Redis Skip Lists
How Postgres B-Trees make index lookups O(log n), and how MongoDB and Redis apply the same structures to geospatial queries and sorted sets.

© 2026 Jatin Jain Saraf (JJS). All rights reserved.