Calculate and specify how much memory is needed to store price values of 24 items.
Answers
Grouping Bits - We need to convert all memory requirements into bits (b) or bytes (B). It is therefore important to
understand the relationship between the two.
A bit is the smallest unit of memory, and is basically a switch. It can be in one of two states, "0" or "1". These states
are sometimes referenced as "off and on", or "no and yes"; but these are simply alternate designations for the same
concept. Given that each bit is capable of holding two possible values, the number of possible different combinations
of values that can be stored in n bits is 2n
. For example:
1 bit can hold 2 = 21
possible values (0 or 1)
2 bits can hold 2 × 2 = 22
= 4 possible values (00, 01, 10, or 11)
3 bits can hold 2 × 2× 2 = 23
= 8 possible values (000, 001, 010, 011, 100, 101, 110, or 111)
4 bits can hold 2 × 2 × 2 × 2 = 24 =16 possible values
5 bits can hold 2 × 2 × 2 × 2 × 2 = 25 =32 possible values
6 bits can hold 2 × 2 × 2 × 2 × 2 × 2 = 26
= 64 possible values
7 bits can hold 2 × 2 × 2 × 2 × 2 × 2 × 2 = 27
= 128 possible values
8 bits can hold 2 × 2 × 2 × 2 × 2 × 2 × 2 × 2 = 28
= 256 possible values
M
n bits can hold 2n
possible values
@gAvYa