What is the most efficient(*) of building a canonical huffman tree?

If frequencies form a monotonic sequence, ie. A0=A1>=...>=An-1, then you can generate an optimal code lengths in O(n) time and O(1) additional space. This algorithm requires only 2 simple passes over the array and it's very fast.

A full description is given in 1.

As I recall, to build a Huffman tree you start with the two least-common leaves and combine them, which removes them from the set and replaces them with a new item that's more common than either (having a count that's the sum of the other two). Then repeat, until there's only one item.

I cant really gove you an answer,but what I can give you is a way to a solution, that is you have to find the anglde that you relate to or peaks your interest. A good paper is one that people get drawn into because it reaches them ln some way.As for me WW11 to me, I think of the holocaust and the effect it had on the survivors, their families and those who stood by and did nothing until it was too late.

Related Questions