Presentation is loading. Please wait.

Presentation is loading. Please wait.

When you add the age of the ship and the age of its boiler, it totals 42 years. So S + B = 42. Now pay attention! The ship is twice as old as the boiler.

Similar presentations


Presentation on theme: "When you add the age of the ship and the age of its boiler, it totals 42 years. So S + B = 42. Now pay attention! The ship is twice as old as the boiler."— Presentation transcript:

1

2 When you add the age of the ship and the age of its boiler, it totals 42 years. So S + B = 42. Now pay attention! The ship is twice as old as the boiler was when the ship was as old as the boiler is now. How old is the ship and how old is the boiler?

3 There are a finite number of choices: 0…42. And since the ship is “twice as old…”, then the ship’s age must be an even number. So try them all 0, 2, 4, 6, …, 42 and see what works Answer: The ship is 24; the boiler is 18.

4 Mother’s age is the son’s age with digits reversed (like 63 and 36). They notice that this is the sixth time in their life that this has happened. And if there are lucky, it will happen two more times. How old are they?

5 Start with mother being 16 years older than son. So we get (16,0), (17,01), (18,02), … Then try 17 years, 18, years, etc. For 18 years different, we get (20,02), (31,13), (42,24), (53,35), (64,46), (75,57), (86,68), (97,79)

6 What’s the point? If the space of possible solutions is small enough, we can solve a problem by simply checking all possibilities.

7 Brute force!

8 What characterizes problems that can be solved this way? Oh yeah! Finite superset.

9 Examples of problems All permutations of 12345 Combination lock 8 Queens Word jumble 9-Square puzzle Maze running Instant Insanity “?????” + “?????” = stuff …and many more

10 Two important attributes “Oh yeah” –Hard to solve, but given an alleged solution, it’s easy to see if it is right. Finite superset –Can test exhaustively

11 Restriction We will look at problems whose solution is a sequence a 1, a 2, a 3 …, a n Where n is known in advance (or at least bounded), and each a i is drawn from a finite pool. Hence finite superset.

12 So to solve by brute force… Systematically generate all elements of the superset. Run each through a filter. Superset generator Filter Solution Not


Download ppt "When you add the age of the ship and the age of its boiler, it totals 42 years. So S + B = 42. Now pay attention! The ship is twice as old as the boiler."

Similar presentations


Ads by Google