- Trending Categories
- Data Structure
- Operating System
- C Programming
- Selected Reading
- UPSC IAS Exams Notes
- Developer's Best Practices
- Questions and Answers
- Effective Resume Writing
- HR Interview Questions
- Computer Glossary
- Who is Who
Height Limited Huffman Trees in Data Structure
The diagram of height limited or depth limited Huffman tree is given below
Tree depth limitation is a non-trivial issue that most real-world Huffman implementations must deal with.
Huffman construction doesn't limit the height or depth. If it would, it is not possible for it to be "optimal". Granted, the largest depth of a Huffman tree is bounded by the Fibonacci series, but that leave sufficient room for larger depth than wanted.
What is the reason to limit Huffman tree depth? Fast Huffman decoders implement lookup tables. It's possible to implement multiple table levels to mitigate the memory cost, but a very fast decoder such as Huff0 goes for a single table, both for simplicity and speed. In which case the table size is treated as a direct product of the tree depth (tablesize = 1 <<treeDepth).
For the benefit of speed and memory management, a limit had to be chosen: it's 8 KB for the decoding table, which nicely fits into Intel's L1 cache, and leaves some room to combine it with other tables if need be. Since latest decoding table uses 2 bytes per cell, it translates into 4K cells, hence a maximum tree depth of 12 bits.
12 bits for compressing literals is generally too short, at least according to optimal Huffman construction.
Constructing a depth-limited tree is therefore a practical issue to solve.
Depth-limited Huffman trees have been studied since the 1960's, so there is so many literatures available.
- Huffman Trees in Data Structure
- Huffman Algorithm for t-ary Trees in Data Structure
- Height-Biased Leftist Trees in Data Structure
- Huffman Codes and Entropy in Data Structure
- Splay trees in Data Structure
- Solid Trees in Data Structure
- Range Trees in Data Structure
- BSP Trees in Data Structure
- R-trees in Data Structure
- Interval Trees in Data Structure
- Segment Trees in Data Structure
- Tournament Trees, Winner Trees and Loser Trees in Data Structure
- Optimal Lopsided Trees in Data Structure
- Threaded Binary Trees in Data Structure
- Red-Black Trees in Data Structure