MULTIMEDIA AND QUALITY OF SERVICE
COMPRESSION
Question
[CLICK ON ANY CHOICE TO KNOW THE RIGHT ANSWER]
|
|
0 = right 1= left
|
|
1 = left 2 = right
|
|
0 = left 1 = right
|
|
0 = middle 1 = back
|
Detailed explanation-1: -As per the Huffman encoding algorithm, for every 1 we traverse towards the right child and for 0 we traverse towards the left one, if we follow this and traverse, we will reach leaf node 3 which represents D.
Detailed explanation-2: -If you have a Huffman code, and the codes have lengths li, then the sum over 2−li must be equal to 1. In your case, that sum is 1/4 + 1/4 + 1/4 + 1/8 = 7/8 < 1, therefore not a Huffman code.
Detailed explanation-3: -The algorithm builds the Huffman tree in a bottom-up manner using the minimum nodes every time. This is called a greedy approach because each character gets its length of code depending on its frequency in the given stream of data.
Detailed explanation-4: -The time complexity of the Huffman algorithm is O(nlogn). Using a heap to store the weight of each tree, each iteration requires O(logn) time to determine the cheapest weight and insert the new weight.