![]() |
CPSC 110-08: Computing on Mobile Phones
|
This topic was covered in class on Monday.
A byte is an 8-bit sequence. Historially an 8-bit byte was used to represent a single character in computer memory.
The length of a binary sequence -- a sequence of 0s and 1s -- determines the number of different sequences that can be generated and therefore the number of different things that can be represented by such a sequence.
For example, with 1 bit, you can have two different sequences, 0 or 1, which can stand for two different colors, say, 0 stands for white and 1 for black. With 2 bits, you can have four different sequences, 00, 01, 10, or 11, which can represent four different colors, white, black, red, green. And so on.
In general, an n-bit sequence can represent 2n different things. Here's how:
Number of bits Number of things Representations 1 2 (i.e., 21) 0, 1 2 4 (i.e., 22) 00, 01, 10, 11 3 8 (i.e., 23) 000, 001, 010, 011, 100, 101, 110, 111 4 16 (i.e., 24) 0000, 0001, 0010, 0011, 0100, 0101, 0110, 0111, 1000, 1001, 1010, 1011, 1100, 1101, 1110, 1111 5 32 (i.e., 25) 6 64 (i.e., 26) 7 128 (i.e., 27) 8 256 (i.e., 28)