GATE CSE
First time here? Checkout the FAQ!
x
+6 votes
215 views

A bag contains $16$ balls of the following colors: 8 red, 4 blue, 2 green, 1 black, and 1 white. Anisha picks a ball randomly from the bag, and messages Babu its color using a string of zeros and ones. She replaces the ball in the bag, and repeats this experiment, many times. What is the minimum expected length of the message she has to convey to Babu per experiment?

  1. $3/2$
  2. $\log 5$
  3. $15/8$
  4. $31/16$
  5. $2$
asked in Probability by Veteran (39.7k points) 256 1308 1941
edited by | 215 views

1 Answer

+7 votes
Best answer

using static huffman compression you can encode the more common colours in fewer bits than the rare colours, that being the case on can expect that common colours will usually be chosen.

eg:

red    1
blue   01
green  001
white  0001
black  0000

on average from 16 draws there will be

8 reds   = 8 bits
4 blues  = 8 bits
2 greens = 6 bits
1 white  = 4 bits
1 black  = 4 bits

for a total of 30/16 = 15/8 bits on average

answered by (389 points) 1 7
selected by
Nice solution by using Huffman coding.Is it possible to solve by using random variable ?


Quick search syntax
tags tag:apple
author user:martin
title title:apple
content content:apple
exclude -tag:apple
force match +apple
views views:100
score score:10
answers answers:2
is accepted isaccepted:true
is closed isclosed:true
Top Users Oct 2017
  1. Arjun

    23398 Points

  2. Bikram

    17078 Points

  3. Habibkhan

    8280 Points

  4. srestha

    6300 Points

  5. Debashish Deka

    5438 Points

  6. jothee

    4978 Points

  7. Sachin Mittal 1

    4772 Points

  8. joshi_nitish

    4348 Points

  9. sushmita

    3970 Points

  10. Rishi yadav

    3804 Points


Recent Badges

Commentator Shivam Chauhan
Notable Question set2018
Nice Comment srestha
Notable Question set2018
Regular Shankar Jha
Popular Question Shubhanshu
Good Comment mcjoshi
Notable Question antarachoudhury
Popular Question shweta12345
Good Comment Rohan Mundhey
27,325 questions
35,176 answers
84,120 comments
33,280 users