GATE Computer ScienceHardGATE CS (PYQ pattern)
Which of the following statements about Huffman coding on a set of symbols with positive frequencies is/are correct? I. If f(a) > f(b), then the codeword of a is never longer than the codeword of b. II. The two least frequent symbols can always be given codewords of the same length. III. A symbol with frequency at least 1/3 of the total always receives a 1-bit codeword.
- A. I and III only
- B. II and III only
- C. I, II and III
- D. I and II only
Correct answer: D. I and II only
I holds because swapping would lower the cost otherwise; II holds since the two least frequent symbols are siblings at the deepest level. III is false: frequencies 15, 26, 21, 33 (33/95 > 1/3) give every symbol a 2-bit codeword.
More Algorithms questions
- Intervals (start, end, weight) are (0,3,4), (1,5,6), (2,6,10), (5,8,7), (4,9,9), (7,10,3), (9,12,8), (8,13,5), (12,15,6), (10,16,12); two…
- Ten unit-time jobs have (deadline, profit): (2,95), (1,60), (2,40), (3,85), (3,30), (1,25), (4,70), (2,20), (4,55), (5,15). Each job takes…
- Seven keys have search probabilities (in percent, in sorted key order) 18, 6, 22, 14, 4, 20, 16 and only successful searches occur. The…
- The egg-drop puzzle: a building has 100 floors, and you have 3 identical eggs. An egg that is dropped from a floor at or above the…
- A building has 100 floors and you have 2 identical eggs; an egg breaks when dropped from the critical floor or above, and a broken egg…
- Floyd–Warshall is run on a 5-vertex directed graph with weight matrix (rows are sources, ∞ = no edge): row1: [0, 6, ∞, 3, ∞]; row2: [∞, 0…