#algorithms
5 articles
Sorting Algorithms, From Scratch
Build real intuition for sorting — from the O(n²) trio you can explain in your sleep to the O(n log n) workhorses that run in every standard library. Covers bubble, selection, insertion, merge, and quicksort with the concepts that actually matter.
Searching: Linear vs Binary
Binary search vs linear search explained from first principles — why halving a sorted list gives you O(log n), when it crushes linear search, and why hash tables beat both.
Shortest Paths (Dijkstra, Bellman-Ford, BFS)
Pick the right shortest-path algorithm the first time: BFS for unweighted graphs, Dijkstra with a heap for non-negative weights, Bellman-Ford when negative edges appear. Concrete worked examples, a decision table, and every gotcha that costs people the interview.
Greedy Algorithms
Make the locally optimal choice and never look back — when greedy is correct it beats dynamic programming cold. The hard part isn't the algorithm, it's knowing when greed works and when it quietly hands you the wrong answer.
Divide & Conquer
Split a problem into smaller subproblems, solve them independently, combine the results. This one mental model gives you merge sort, quickselect, the count-inversions trick, and Kadane's origin story — plus the intuition for why n log n is the price of sorting.