Algorithm Analysis
Time and Space Complexity Analysis
- Time complexity: O(n log n), where n is the number of characters.
- Space complexity: O(n), needed for storing the Huffman Tree.
Compression Ratio Analysis
The compression ratio depends on the input data. Texts with more repetitive characters usually get better compression ratios.