4

Reading Assignment and Discussion Topics
Computer Science 111

for class on Thursday Feb. 12, 1998

Please read Sections 2.3.3 through 2.4 of the Schneider and Gersting text, and be prepared to discuss the following:

1. The pattern-matching algorithm on page 51 has a nested loop: one Repeat loop appears inside another. This is an extremely useful structure that we will see again and again. Here's another application: find the location of the black king on a chessboard, assuming you can examine just one square at a time. Here's another: count the number of white pawns on the chessboard. How would you approach these problems?

2. In the last class we found the average of a set of numbers. Today, let's find their median. Remember that the median has the property that half the numbers are smaller than it and half larger (plus or minus one number).