Suppose we have been given that our prefix-free binary code has 11 codewords of length 4, and 2 codewords of length 2. We are asked to come up with an example for it, but how can we make 11 codewords when the code length is 4 and we can only use 1s and 0s (binary code).
Asked
Active
Viewed 121 times
0
-
1You should at least attempt to solve this and show what you have done; from the looks of it, you need to do your own homework. – ismellike Sep 18 '13 at 00:38
-
By "`11` code words," do you mean `3`? – Andon M. Coleman Sep 18 '13 at 01:12
-
uh, i don't understand how we can get it, i'm not asking for an example... – user65165 Sep 18 '13 at 01:19
1 Answers
3
You don't have to fill the binary space. For instance, if there were only two codewords they could be 0010 and 0001; all other codewords (1, 0000, 0011, etc) would be invalid and any application interpreting the code should generate an error upon encountering them.
That said, you won't find an example because this particular code's requirements are impossible to satisfy.

adipy
- 166
- 3
-
1Yes, Kraft's inequality* adds up to 1.1875 which is greater than 1, hence not possible. The most you could have is two of 2 or length 2 or less, and four of length 4. *http://trsys.faculty.jacobs-university.de/english/hfn/btree.pdf – Dijkgraaf Sep 18 '13 at 01:20
-
i made up the numbers, i was interested only in the filling of the binary space part – user65165 Sep 18 '13 at 01:21
-
haha yea i wasn't trying to be very precise, just to get an idea about the real question i had – user65165 Sep 18 '13 at 01:22
-
Well the link I gave you has a binary tree that shows you how to fill it in. – Dijkgraaf Sep 18 '13 at 01:41
-
@Dijkgraaf: Which is why I still say `11` in this question is meant to be "one one" or `3`... Then this question makes sense :) – Andon M. Coleman Sep 18 '13 at 01:47
-
Which would make it a bad question as the other numbers in the question aren't in binary notation and the notation is not indicated. – Dijkgraaf Sep 18 '13 at 02:10
-
@Dijkgraaf: Not really, it's the kind of question you'd see in an interview; designed to trick people who don't pick-up on subtle context clues. In fact I remember an extra credit question like this in undergraduate discrete math - I was the only person in the class who got it. I was beginning to think that's what this question was until the OP mentioned he just pulled those numbers out of thin air. – Andon M. Coleman Sep 18 '13 at 03:23