logo separator

[mkgmap-dev] Building Huffman tree

From Ticker Berkin rwb-mkgmap at jagit.co.uk on Fri Dec 31 09:57:20 GMT 2021

Hi Gerd

Some thoughts on this:

Dividing the \0 count by some factor between 3 and 6 should reduce the
overall length of the strings. This is because there will be 0..7 bits
free after each string

To make the canonical tree: after using the standard algo to make a
normal tree, just remember the count at each level and chuck the tree
away. Then simply allocate chars, in decreasing frequency order, in
previously levels, from root (and maybe high to low), much the same way
as the decoder handles levels 6 and above.

It might be that if you start with ordered list when building the
initial tree, and get the inequalities right for when sums of lower
levels are equal, you get the canonical tree, but this is just a guess.

Happy new year
Ticker




More information about the mkgmap-dev mailing list