137 views

From huffmann encoding how will we find max and min number of comparisons?

what will be the max and min comparisons here

well i think we can do this way but i  havent used any formula regarding huffman code

it is like merging the files,,if you have lower no. of element in the leafs then there will be less number of comparisons because you are doing comparisons equal to height of the tree,

as we know no of comparisons for two groups of element having n and m element are n+m-1

so at each merging point we have given the sum of below nodes so just minus one from each node and add them so you will get 219 comparisons it is minimum and for max just interchange the node of higher weights to lower leaf =362 comparisons
@red

i understood the minimum ......

Can u explain max in a bit more detailed way
Well how can you get a max number of comparisons?? only if you include the higher weights(sort them in decresing order) maximum numbers of time in calculations and this is posible only when you use them in leaf nodes.