GATE CS 2021 · Set-2 · Asymptotic Analysis & Recurrences

MCQ · 2 marks · Problem PROG-DIVC-0078

Consider the string abbccddeee. Each letter in the string must be assigned a binary code satisfying the following properties:For any two letters, the code assigned to one letter must not be a prefix of the code assigned to the other letter.For any two letters of the same frequency, the letter which occurs earlier in the dictionary order is assigned a code whose length is at most the length of the code assigned to the other letter.Among the set of all binary code assignments which satisfy the above two properties, what is the minimum length of the encoded string?
  1. A
    21
  2. B
    23
  3. C
    25
  4. D
    30

Solve it on GATE DA practice →More Searching & Sorting Algorithms problems

Show the worked solutionOfficial GATE Answer Key: Option B.See full step-by-step discussion on GateOverflow: https://gateoverflow.in/357514/gate-cse-2021-set-2-question-26

GATE DA practice: past exam problems by chapter, with worked solutions · gatedaprep.com