Part B Huffman Tree
Q0. Consider the first letter of your CS userid (login name) is “W”. Use this letter to determine your NUMBER for this lab as follows:
First Letter of Userid Number
sample answer structure:
0. My number is: XXXX
1. My tree has XXXX nodes. Its height is XXXX.
3. XXXX Copy it to your filespace, and complete
it by replacing XXXX with the correct answer for each question.
1. Consider an alphabet containing only the following 11 characters, with the given frequencies:
_ 99 (the underscore character)
r 4 (choose r before 0 when making tree)
Construct a huffman tree for the alphabet using the method from T-22 in class notes, as follows. When pairing 2 items, the one with the smaller frequency goes on the left, and its arc has label 1. If two items with the SAME frequency are being paired, then this is how you must determine which one goes on the left:
-if both items are characters in the alphabet above, then the one that is smaller, in alphabetical order, as given above, goes on the left.
-if one is a character of the alphabet, and the other is a created node, then the character goes on the left
-if both are created nodes, then the one was the one created first goes on the left.
If you are trying to choose between 2 items on the list which have the same frequency, choose this one:
-the one that existed on the list first (e.g., if one is a character of the alphabet, and one is a created node, choose the character first). How many nodes does your Huffman tree have? What is your tree’s height?
2. Give the encoding for the word that corresponds to your NUMBER, which you found in question 0.
3. Find the phrase that corresponds to your NUMBER by decoding the code that corresponds to your NUMBER.