The following posts contain some materials from the algorithm series (6.006, 6.046 and 6.851) at MIT.

Huffman Encoding

4 minute read

Huffman coding: prefix-free codes, greedy merging, and heap-based runtime analysis

Fractional knapsack

2 minute read

Fractional knapsack: value-density greedy strategy and why it differs from 0-1 knapsack

Rod Cutting (DP Intro)

4 minute read

Rod-cutting as DP: brute force vs memoization vs bottom-up, plus solution reconstruction

AVL Search Tree

3 minute read

AVL trees: balance invariants, rotations, and why height stays O(log n)

Binary Search Tree (BST)

5 minute read

Binary search trees: core operations, successors, insertion, and deletion via transplant

Tree Basics & Tricks

2 minute read

Tree terminology, traversals, and a few practical iterative traversal tricks

Hashing

6 minute read

Hash tables from direct addressing to chaining and open addressing, with probe analysis

Doubly Linked-List

3 minute read

Doubly linked lists with and without sentinels, plus search/insert/delete pseudocode

Stack & Queue

less than 1 minute read

Stack and circular queue pseudocode with overflow/underflow checks and wrap-around logic

Bucket Sort

2 minute read

Bucket sort for roughly uniform inputs, with insertion sort per bucket and runtime notes

Radix Sort

1 minute read

Radix sort from least-significant digit upward, and why stability is required

Decision Tree

less than 1 minute read

Decision trees for comparison sorts, and why comparison sorting needs Ω(n log n)

Counting Sort

2 minute read

Stable counting sort in Θ(n+k), with pseudocode and Scala/Python implementations

Randomized Sort

2 minute read

Randomized quicksort: random pivots to avoid adversarial inputs and worst-case splits

Quick Sort

3 minute read

Quicksort partitioning intuition, loop invariants, and best/average/worst-case analysis

Heap Sort

7 minute read

Heap sort explained with max-heapify intuition, CLRS notes, and sample implementations

Merge Sort

4 minute read

Merge sort via divide-and-conquer, with sentinels, recursion tree analysis, and code

Insertion Sort

2 minute read

Iterative + recursive insertion sort, with complexity notes and Python/Scala examples