GATE CS 2021 (Afternoon) — Question 36

AlgorithmsGreedy Approach & Divide-and-Conquer DesignsMCQ2 marks · −2/3 if wrongMedium

Consider the string abbccdddee. Each letter in the string must be assigned a binary code satisfying the following properties: 1. For any two letters, the code assigned to one letter must not be a prefix of the code assigned to the other letter. 2. 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
Practise the full 2021-AN paper
Challenge a friend: WhatsApp Telegram
From RENYXERAFree All-India Mock — every SundayA full GATE CS paper, exactly 180 minutes, ranked across India with your GATE score.
Practise more on Greedy Approach & Divide-and-Conquer DesignsTimed, in the real exam interface · free to start

A GATE question every morning

One real past-paper question every morning for your branch, answer hidden until you tap. Free on Telegram.

Join
Stuck? Ask in the student group