Counting and Comparing
CPS 004.1, 1 July 2003
Form groups of two persons.
You should start this group activity by
introducing yourself to
each member of the group. (It is recommended that this not be the
same group you were part of last time.) You may also want
to choose one person to
write down the group's discussion
on the provided transparency as you go so that it can be displayed on
the classroom's overhead projector.
Counting m&m's
Given a bag of m&m's, provide a precise procedure for determining which color is represented by the
most m&m's and which by the least (i.e., the most generic and most rare colors in the bag). It has been
said that brown m&m's are the most common ones, while green m&m's are the most rare (and thus taste
the best). Individual groups will attempt to answer this question for their bag; as a class, we will try to
make a more significant statement.
It is typically easy for a human to look at ten things and say which is the largest, or the tallest, or the
brightest. Humans can easily compare many things at once visually. And it will be especially tempting for
you to do this with the piles of brightly colored candies in front of you. However, to understand how a
counting computer would solve the problem, try imagining finding the tallest thing in a completely dark
room. Or think about an animal in a snow covered forest --- how does that animal find the best shelter
when it cannot directly compare all the possible shelters at once? In other words, without being able to
simply see the answer.
You can assume your counting computer knows how to:
- make a pile of things
- add one thing to a pile of things
- report how many things are in a pile
- report if one number is smaller than, equal to, or larger than another
- report if one color is the same as or different from another
- remember a number or a pile
- report its color
Extra Credit: Making Comparisons
Early on in our lives, we learn that some numbers are bigger than others. At this point, it is impossible to
say how we do this task. It is just something we know. Computers know this fundamental ordering of
numbers as well --- it is "hard-wired" into them when they are created. However, there are many
things that we must still figure out how to compare when we encounter them (or perhaps remind
ourselves). Computers must also be programmed to know how to compare things more complex than
numbers. It is these things for which we can formulate algorithms.
You should describe how to compare the following things:
- volume of two boxes
- density of two oddly shaped things, like a king's crown for example
- height of two buildings in different cities, or at least not so close that you can see them together
- which of two boxes of different shape completely holds a collection of oddly shaped items
- lung capacity of two people
- alphabetic order of two words (you may assume you know if one letter is alphabetically before
another)
- can you think of other interesting comparisons?