Problem Solving and Computing (CSC-103 98S)

[Instructions] [Search] [Current] [Changes] [Syllabus] [Handouts] [Outlines] [Journal] [Problems] [Computing] [SamR Docs] [Tutorial] [API]

# Problem Set 6: General Problem Solving

Assigned: Thursday, March 5, 1998
Due: Thursday, March 12, 1998

Feel free to work on the problems in any order.

1. The Towers of Hanoi

[Taken from this history of computer science.]

Greg and Genny Grinnellian have taken summer internships at Bell Labs.

In the musty basements of Bell Laboratories, there are a number of varying sized reels of tape stacked on top of each other in a bin. There are three bins in which reels of tape can be placed. Each reel of tape can only be stacked on top of larger reels.

After arriving at Bell, Greg and Genny have discovered that their first task is to move all of the reels of tape from the first bin to the third bin. The reels of tape are so fragile that they can only move one reel at a time, and must work together to move the reel. The reels can only be stored in bins (not on the floor or elsewhere). For some reason, all of the reels are labeled "Hanoi".

We begin with all the reels in the leftmost bin. For now, we'll assume that there are just three reels.

```|  X  | |     | |     |
| XXX | |     | |     |
|XXXXX| |     | |     |
+-----+ +-----+ +-----+
Left    Center  Right
```

Their goal is to get all of the reels into the right bin, as in

```|     | |     | |  X  |
|     | |     | | XXX |
|     | |     | |XXXXX|
+-----+ +-----+ +-----+
Left    Center  Right
```

Suggest a strategy that they should use to move the tapes. Recall that only one tape can move at a time, and it is illegal to put larger tapes on top of smaller tapes.

Would they use a different strategy if there were four tapes?

2. Finger Multiplication

[From the notes of Emily Moore. Modified slightly by Sam Rebelsky.]

The following technique was widely used in medieval Europe. Knowing how to multiply two numbers less than 6, you can multiply two numbers between 5 and 10. The process is based on a single-hand representation of numbers between 5 and 10. To represent a number, N, you hold down N-5 fingers.

Here's the strategy, as it was told to me.

Open both palms towards you. To calculate 7 times 9, say, put two fingers down on the left hand (7-5 is 2) and put four fingers down on the right (9-5 is four). Count the number of down fingers (4+2=6) and multiply together the number of up fingers (3 times 1 = 3) and put the two answers together (63). When the number that should be the ones digit is larger than 9, you will have to carry to the tens digit.

Does this work for any two numbers between 5 and 10? Stuck? You may want to try other products to get a better understanding. You may also want to assign variables to quantities in the problem.

3. Chris and Mik

[Based on a problem by Emily Moore. Reworded by Sam Rebelsky.]

Two students, Chris and Mik, are returning from Jimbo's to a film in the Harris center. Chris decides to walk half the way and run the other half. Mik decides to run for half the time and walk for the other half. (No, I have no idea how Mik figures out what "half the time" is.) Both Chris and Mik walk at the same speed and run at the same speed. Who finishes first?

4. A Fly in the Fries

[Based on a problem by Emily Moore. Reworded by Sam Rebelsky.]

Twenty-five french fries are arranged in a five-by-five grid. A fly lands on one randomly chosen french fry and tries to reach every french fry exactly once. For some reason, the grease on the french fries limits the directions in which the fly can move, so that it can only move to a french fry in an adjacent row or column.

Is it always possible for the fly to reach every fry? If not, suggest a counterexample. If so, come up with an algorithm.

[Based on a problem by Emily Moore. Reworded by Sam Rebelsky.]

The Smith's have a pair of twins, which they've named One and Two. Mr. Smith regularly bakes cookies for the twins. To help ensure "fair" consumption, he sets up a number of rules for eating cookies.

• The twins must alternate eating, passing the plate between them.
• A twin may eat one or two cookies before passing the plate to the other twin.
• The last twin to eat a cookie must do the dishes.
• The twins must eat all the cookies.

Develop a strategy for eating cookies. Assume that the twins don't like to wash dishes, and that they so dislike washing dishes that they'll sacrifice eating a large number of cookies in order to avoid washing dishes.

Is this at all similar to a game you've previously encountered? How does your strategy for this problem relate to your strategy for that game?

[Instructions] [Search] [Current] [Changes] [Syllabus] [Handouts] [Outlines] [Journal] [Problems] [Computing] [SamR Docs] [Tutorial] [API]

Disclaimer Often, these pages were created "on the fly" with little, if any, proofreading. Any or all of the information on the pages may be incorrect. Please contact me if you notice errors.