A course in TCP/IP
networking
Part 2: Enumeration
Numerals can be attached to objects in the process of “numbering” or “enumeration”. In this common, everyday process, an incremented numerical value is assigned to each object in order. The first object is numbered “0.” The second is numbered “1.” The third is numbered “2” and so on. Each time an object must be enumerated, the last numerical value used is incremented by one and attached to the object.
Using one place in base 10, 10 objects may be enumerated: 0,1,2,3,4,5,6,7,8 and 9. Using two places, 100 objects may be enumerated. Three places allow the enumeration of 1000 objects. Obviously it is possible in base 10 to enumerate the number of objects equal to 10 raised to the number of places used. In base 10 it is therefore possible to enumerate 105 (100,000) objects using 5 places: 0 to 99999.
In base 2, two objects may be enumerated using one place: 0 and 1. Using two places, four objects may be enumerated, 0,1,10 and 11. Using three places, eight objects may be enumerated, 0,1,10,11,100,101,110 and 111. The same rule of enumeration applies to base 2 as base 10. In base 2, it is possible to the number of objects equal to 2 raised to the number of places used. It is possible to enumerate 25, or 32 objects using 5 places: 0 to 11111.
This rule can be generalized to any numerical base: The number of objects enumerated by a specified number of places is equal to the value of the base raised to the number of places. Using 14 places in base 36 it is therefore possible (though probably not useful) to enumerate 3614 objects.
Practice problems:
1. How many objects can be enumerated using 3 places in base 5? What are the largest and smallest numerals used?
2. How many objects can be enumerated using 2 places in base 16? What are the smallest and largest numerals used?
3. How many objects can be enumerated using one byte? What are the smallest and largest numerals used?
4. Enumerate nine objects in binary, using the fewest possible number of places.
Solutions:
1. How many objects can be enumerated using 3 places in base 5? What are the largest and smallest numerals used?
125 = 53
Smallest value: 0
Largest value: 444
2. How many objects can be enumerated using 2 places in base 16? What are the smallest and largest numerals used?
256 = 162
Smallest: 0
Largest: ff
3. How many objects can be enumerated using one byte? What are the smallest and largest numerals used?
One byte equals eight bits, or eight places, each of which has two possible states, 0 and 1.
256=28
Smallest: 0
Largest: 11111111
4. Enumerate nine objects in binary, using the fewest possible number of places.
In binary, 23, or eight, objects can be enumerated using three places. Sixteen objects, or 24, can be enumerated using four places. To enumerate nine objects therefore requires four places. The numerals attached to the objects will then be:
0,1,10,11,100,101,110,111,1000