TEXT COMPRESSION
Algorithm Reference
RLE — Run-Length Encoding: Replaces consecutive repeating characters with count+char. Best for data with many runs (e.g., images, repeated patterns).
LZ77 — Sliding Window: Finds repeated substrings and replaces them with back-references (offset, length). Foundation of gzip, zip, png.
Huffman — Variable-length codes: Assigns shorter bit codes to frequent characters. Optimal prefix-free coding.
Base64 — Not actually compression (expands ~33%). Encodes binary data as ASCII text. Included for encoding/decoding utility.
Deflate — Combines LZ77 + Huffman for better compression. The algorithm behind gzip and zip.