[Math] How many bits are needed to encode the following data

computer science

A weather station on Santa Rosa Island sends data about weather conditions once every
15 minutes. The data sent is as follows:

  • Temperature (0..60 degrees Celsius)
  • Wind speed (0..170 kph)
  • Wind direction (0..359 degrees from North)
  • Humidity (0..100%)

How many bits per hour need to be sent?

Here is my approach: 2^6 bits are needed to encode values in the range 0-60. So 6 bits are necessary to encode temperature. 8 bits are needed to encode values in the range 0-170. So 2^8 bits are necessary to encode wind speed. And so on.

Any thoughts?

Best Answer

In fact, the minimum number of bits required (per update) will be $\lceil\log_2(61)+\log_2(171 )+\log_2(360)+\log_2(101)\rceil = 29$: there is no requirement in the question that we encode each type of information using separate bits.

This is in contrast to your answer of $\lceil\log_2 61\rceil + \lceil\log_2 171\rceil + \lceil\log_2 360\rceil + \lceil\log_2 101\rceil = 30$.