Below are some statements. For each statement, say whether it is
true or
false and justify it in a few words. Note that the rationale here
is most important.
a) If one letter has the frequency 0.45 (ie 45%) then he always has
1-bit code in Huffman
coding, no matter what frequency the letters have.
b) If P ≠ NP then requires a timer algorithm for all tasks in the
NP.
d) The radix-sort has the same time complexity, whether
the input is ordered or unordered.
e) If x and y are two binary heap leaves, the difference is their
depth (ie distance
from the root most 1.
(a) It is TRUE.
If a letter has the frequency of 0.45 then that letter always
has 1-bit code in Huffman
coding, no matter what frequency the other letters have. Because
that letter will be in left and represented by 1. All the other
letters will have a cumulative frequency of (1 - 0.45) = 0.55. That
will be represented at the right side and will be distributed
further.
(b) It is TRUE.
Nothing has been proven yet. But if we assume that P ≠ NP then requires a timer algorithm for all tasks in the NP and also for all tasks in the P.
(c) It is TRUE.
The radix sort has the same time complexity, whether the input is ordered or unordered. The procedure sorts the number array by the digits.
(d) It is TRUE.
If x and y are two binary heap leaves, the difference of their depth from the root is at most 1. Because, like a binary tree a binary heap starts filling from top to bottom and after a level is filled, the next level starts to fill up. So, in binary heap the leaves can be at the lowest level or the level above the lowest level.
Hope this helps.
Below are some statements. For each statement, say whether it is true or false and justify...