Binary Search: Looking for a needle in a haystack
- Judah L Schwartz
In this applet - in 1 dimension x is an integer on a line that ranges from 1 to 128. on the plane x and y are integers that each range from 1 to 128. There are 16,384 points on this plane. in the cube x, y and z are integers that each range from 1 to 128. There are 2,097,152 points in this cube. Choose a dimension in which search for a mystery point that the program chooses. On the line - because you are searching in only one dimension it is very easy to locate the mystery point. But there are many more points in the plane and far more points in the cube! Nonetheless, in both the plane and the cube you should be able to find the mystery point in no more than 7 guesses!! Why?