Huffman Coding - Optimal Prefix Codes
Goal: Optimal prefix-free binary codes based on frequency
Greedy: Always merge two nodes with smallest frequencies
β’ Frequent chars get shorter codes
β’ No code is prefix of another
Time: O(n log n)
O(n log n)