Construct a Huffman tree for a file that contains a single s…
Construct a Huffman tree for a file that contains a single string “dsa is dsa”. Use the following constraints when building the tree: the node with a lower frequency is attached to the left in case two nodes are merged after extraction from the priority queue; if two nodes have the same priority when merging, then the merged nodes are resolved as follows: if both nodes have letters (a.k.a. left nodes) then the letter with lower ascii value will be the left node when combining two nodes into a tree. Ascii value of space is 32, a is 97, d is 100, i is 105 and s is 115. if one or both nodes have cumulative frequencies, then the node with more number of nodes in the tree will be attached to the right, in other words, the smaller tree will be towards the left. traversing left from a node appends ‘0’ to the Huffman code and traversing right appends ‘1’. Decode the following Huffman code using the tree: 01000111111010
Read Details