for class on Tuesday Feb. 8, 2000
Please read Chapter 2, up to Section 2.3.3 (p. 54), of the Schneider and Gersting text, and be prepared to discuss the following issues:
1. In this class we will continue to look at algorithms for some simple problems. We will use text's "pseudocode" when it is helpful. In the first class we found the smallest price in an array of prices (the shelf full of shampoo bottles). How would you find the average price?
2. In the first problem set you grappled with Euclid's algorithm (page 23). Suppose you insist in step 1 that I be the larger of I and J. How would you "swap" their values if I was initially the smaller?
3. How would you translate Euclid's algorithm into pseudocode, using either a while construct or a repeat ?