How to do Huffman encoding of base 3
-
26-10-2019 - |
Question
I have a problem in my program implement Huffman encoding. In base 2, I use a binary tree to store codeword, but I don't know how to deal with base 3. I'm trying to use a trinary tree, but don't know how to implement it with a trinary, how to add 0,1,2 symbol...
Solution
I know little about the huffman tree but instead to use 0 and 1 to mark the branches in a ternary tree I would use the letters A,B and C for each branches. Then I can traverse the tree for a letter and remember the codeword for example: ABBCA.
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow