Find what fits in three bits — quick review
Imagine a fair booth that prints 000 on its first ticket.
Start with one empty row and double the count for each bit you add. Two choices for each of three positions make eight patterns. The unsigned values run from zero to one less than the pattern count. With three bits they run from 0 through 7.
Write down the convention, the rule for using the codes. Give each ticket a different three-bit pattern and make every pattern available.
Begin with no digits and fill the slots from left to right. Follow
0before1at each split. Record the row once it has three digits, then go back to the last split with a branch left to follow. Finish when you have followed every branch.Count the finished rows, including
000. Find the largest unsigned value by adding the place values in the all-ones row.
If you counted seven codes, check where you started. The pattern 000 reads as zero and is one of the eight patterns. If the booth sets 000 aside to mean “no ticket,” it still appears in the list. The booth has seven codes to hand out.