Shannon-Fano Code
A tool for generating optimal prefix compression codes.
📚 About Algorithm
The Shannon-Fano method is used to construct codes with minimal redundancy. Higher probability symbols receive shorter binary sequences.
- 1. Symbols are sorted by descending probabilities.
- 2. The list is recursively split into two parts with the closest possible total probabilities.
- 3. The upper part is assigned '0', and the lower part is assigned '1'.
⚙️ Calculation
// Waiting for input...