Algocraft · Theory
All 13 theory pages, in one place
Every category on the site has a theory page: diagrams, a worked example, a repeatable framework, and a pitfalls checklist — written to teach the idea, not just describe the visualizer. Pick a topic below, or follow the DSA Roadmap for the order that actually builds on itself.
Foundations
Sorting & Searching
Sort Theory
Comparison vs. distribution-based
Four families of sorting algorithms, a Quick Sort partition walkthrough, and when each one actually wins.
Read Sort Theory →Binary Search Theory
Monotonic predicates
Why halving the search space works, plus "binary search on the answer" — the pattern's biggest generalization.
Read Binary Search Theory →Patterns
Stacks, Sliding Window & Strings
Stack Theory
LIFO + monotonic stacks
When "look back until something breaks" is the tell, and why the monotonic stack pattern is amortized O(n).
Read Stack Theory →Sliding Window Theory
Two pointers, O(n)
Fixed vs. variable windows, and the monotonic-deque trick behind Sliding Window Maximum.
Read Sliding Window Theory →String Matching Theory
KMP's LPS table
Why naive search is O(n·m), and how KMP never re-checks a character it already matched.
Read String Matching Theory →Data structures
Linked Lists, Trees & Heaps
Linked List Theory
Pointer surgery
The dummy-head trick, the prev/curr/next reversal sweep, and how LRU Cache combines a list with a hashmap.
Read Linked List Theory →Trees Theory
Recursive by definition
The three DFS orders and when each one matters, plus the BST invariant that makes search O(log n).
Read Trees Theory →Heap Theory
A tree hiding in an array
Parent/child index formulas, sift-up/sift-down, and the surprising O(n) bound on building a heap.
Read Heap Theory →Algorithms
Backtracking, Graphs, DP & Greedy
Backtracking Theory
Explore → prune → undo
Why pruning — not cleverness — is what makes backtracking fast in practice.
Read Backtracking Theory →Graphs Theory
BFS, DFS, Dijkstra, MST
Why BFS guarantees shortest paths, Dijkstra as weighted BFS, and Prim vs. Kruskal for MST.
Read Graphs Theory →Dynamic Programming Theory
Overlapping subproblems
The two properties every DP problem has, Top-Down vs. Bottom-Up, and a repeatable 5-step framework.
Read DP Theory →Greedy Theory
Local choice, never revisited
When the greedy bet is safe — and the classic counterexample where it isn't.
Read Greedy Theory →Capstone