문제

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