
Dependencies Have an Order. Topological Sort Finds It.
Learn topological sort with Kahn's algorithm and DFS, cycle detection, and 14 language implementations. Includes Course Schedule and Alien Dictionary.
Page 60 of 61 · Ideas for curious minds in tech.
Back to the archive
Learn topological sort with Kahn's algorithm and DFS, cycle detection, and 14 language implementations. Includes Course Schedule and Alien Dictionary.

Merge sort vs quicksort: stability, O(n²) traps, pivot selection, and what your language actually uses. Includes 14 language implementations.

Learn how greedy algorithms work, when they're provably correct, and when they quietly fail. Proofs, canonical problems, and code in 14 languages.
Master the backtracking algorithm with the choose-explore-unchoose loop, tree complexity analysis, pruning strategies, and 14 language implementations.

The sliding window technique collapses O(n²) into O(n). Fixed windows, variable windows, monotonic deques, and the exactly-k trick across 14 languages.

The complete breadth-first search algorithm guide: O(V+E) complexity proof, the mark-before-enqueue bug, and implementations in 14 languages.

Master depth-first search: recursive vs iterative, O(V+E) complexity, directed graph cycle detection, and 14 language implementations for coding interviews.

Master binary search with the loop invariant approach: lower bound, upper bound, binary search on answer, and off-by-one pitfalls in 14 languages.

How LRU cache implementation works under the hood: hash map plus doubly linked list. Full code in Python, Java, C++, JavaScript, and 10 more languages.

The monotonic stack turns O(n²) into O(n) with one invariant. Learn how it works, when to use it, and solve Daily Temperatures and Sliding Window Max.

AVL tree vs Red-Black tree explained: how each enforces balance, when to use which, and how both power TreeMap, std::map, and interview problems.

The Fenwick tree (Binary Indexed Tree) gives you O(log n) prefix sums and updates. Learn how i & -i drives everything, with code in 10 languages.

Master the segment tree: flat array layout, O(log n) range queries, point updates, and lazy propagation. Code in Python, TypeScript, Java, and more.

Learn the union find algorithm with path compression and union by rank. Two flat arrays, near-constant time, implementations in 12 languages.

Master graph data structure interview questions: adjacency list vs matrix, BFS vs DFS with code examples, and how to spot hidden graph problems.

Master the heap data structure: how min and max heaps work internally, why build-heap is O(n), and implementations in Python, Java, C++, and more.

Master the trie data structure: how prefix trees work, O(m) time complexity explained, and implementations in Python, TypeScript, Java, C++, and more.

Master the binary search tree: how one invariant powers O(log n) search, insert, and delete, and why insert order determines if you get O(log n) or O(n).

Binary tree traversal explained for coding interviews. Covers preorder, inorder, postorder, BFS, O(h) space complexity, and iterative implementations.

Hash set time complexity explained: why O(1) lookup works, how collision handling and resizing work, and the Two Sum and LCS interview patterns.

Hash map time complexity is O(1) average, not guaranteed. Learn collision resolution, load factors, and hash flooding with real implementation details.

Learn how the deque data structure works and how the monotonic deque pattern solves sliding window maximum in O(n) instead of O(nk) or a heap.

The queue data structure explained: circular buffer mechanics, BFS patterns, and implementations in Python, Java, TypeScript, and 8 more languages.

Master the stack data structure for coding interviews: LIFO mechanics, array vs linked list tradeoffs, amortized analysis, and patterns like monotonic stack.