سؤال

So I'm working on some homework and am completely stumped by this current question.

Assume that there are 73 students in your class. If every student is to be assigned a unique bit pattern, what is the minimum number of bits to this? And Why?

I don't know how to get the solution to this, is it 73!? If not how do I determine this solution

THANK YOU ALL FOR THE ANSWERS....SOLVED :D

هل كانت مفيدة؟

المحلول

There are some elegant mathematical solutions in the comments, but think of it like this:

1 bit gives you two possible bit patterns.
2 bits gives you four
3 bits gives you eight
.
.
.
.

Continue in the same vein until you have a number of bit patterns larger than the number of students.

نصائح أخرى

You have to be able to represent 73 numbers in binary. You can easily notice, that there are 73 numbers in range [0, 72], so you need as many bits as you have to have to represent the number 72 in binary.

2^6 = 64 < 72 < 128 = 2^7

so you need 7 bits to represent 73 different numbers.

Since bits can simply be thought of as binary digits, we can convert the base-10 72 to the base-2 1001000 and determine our answer, which is the number of digits in this base-2 number, 7. To get the number 72, take into account that we can assign the number 0 to one of the students.

Another way to get the answer is to find the smallest n for which 2^n > 73.

مرخصة بموجب: CC-BY-SA مع الإسناد
لا تنتمي إلى StackOverflow
scroll top