Answer:
Check the explanation
Explanation:
a) kindly check the below diagram for solutions to question a
b) The Huffman algorithm used to build the tree is as follows;
• Collect n initial Huffman trees, such that each is a single leaf node Create a priority queue and insert the n trees in the priority queue for frequency
• Now, pick the two nodes having the lowest queue, and join them to form the tree such that the root of the tree has two nodes. The weight of the tree is the sum of the weight of the two data nodes
• insert the new tree in the priority queue
• Repeat the above steps until all the nodes have been combined into one tree
c) kindly check the below image for solutions to question c