I study Huffman Coding tree from "Data Structures and Algorithm Analysis" of Shaffer and it says that Huffman Coding tree is an opportunity to experience a search trie. However, the code implements it with a heap class.

As a result, I wonder if Huffman Coding tree is actually a heap or a trie? If it is a heap, is it a mimHeap or a maxHeap. I'm somehow confused because there are some online resources calling it a minHeap, as it should be a maxHeap.

Anyway, thank you very much in advance.


1 Answer 1


A Huffman tree is a trie: its edges are labeled by $0,1$, and its paths spell out binary words.

Huffman's algorithm uses a min-heap to construct the Huffman tree. At each step, we choose the two items with minimal probability, and merge them.


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.