Huffman Coding
← Back to Classic Problems (Greedy)
A greedy algorithm for constructing an optimal prefix-free binary code for data compression. Assigns shorter codes to more frequent symbols. Builds a binary tree bottom-up by repeatedly merging the two lowest-frequency nodes. O(n log n) time.