Take the 2-minute tour ×
Mathematics Stack Exchange is a question and answer site for people studying math at any level and professionals in related fields. It's 100% free, no registration required.

I'm having trouble with this homework problem. Do I create the tree by beginning with each weight being a leaf? Then combining the lowest weighted leaves, and their parent becomes the sum of their weight?

I got 85 as my answer for (b) but I'm not sure if this is the correct process


Consider the weights: 10, 12, 13, 16, 17, 17.

(a) Construct an optimal coding scheme for the weights given by using a tree.

(b) What is the total weight of the tree you found in part (a)?

share|improve this question

1 Answer 1

up vote 0 down vote accepted

Yes, you first combine $10+12=22$, then $13+16=29$, then $17+17=34$, then $22+29=51$, finally $51+34=85$ (thus your answer for b).

If we always represent the first choice with 0 and the second with 1, the respective code words are $$000,001, 010, 011, 10, 11.$$ I'm not sure if part b isn't rather referring to the weighted code word length, that is $\frac{3\cdot 10+3\cdot 12+3\cdot 13+3\cdot 16+2\cdot 17+2\cdot 17}{10+12+13+16+17+17}$.

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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