Download presentation

1
**The Algorithmic problems?**

2
The 3 water jug problem There are three jugs on the table - 3, 5, and 8 ltr. The first two are empty, the last contains 8 ltr. of water. By pouring water from one glass to another make at least one of them contain exactly 4 ltr. of water.

3
3 Water Jug Problem

4
**The 3 water jug solution Move from 3 to 1 Move from 1 to 2**

Final - Jug1: 3, Jug2: 1, Jug3:4

5
The Tower of Hanoi The Tower of Hanoi or Towers of Hanoi is a mathematical game or puzzle. It consists of three rods, and a number of disks of different sizes which can slide onto any rod. The puzzle starts with the disks in a neat stack in ascending order of size on one rod, the smallest at the top, thus making a conical shape. The objective of the puzzle is to move the entire stack to another rod, obeying the following rules: Only one disk may be moved at a time. Each move consists of taking the upper disk from one of the rods and sliding it onto another rod, on top of the other disks that may already be present on that rod. No disk may be placed on top of a smaller disk.

6
The Tower of Hanoi

7
**The Tower of Hanoi (Solution)**

If Disks are 3: Move from Src to Dst Move from Src to Aux Move from Dst to Aux Move from Aux to Src Move from Aux to Dst

8
**The Tower of Hanoi (Solution)**

If Disks are 4: Move from Src to Aux Move from Src to Dst Move from Aux to Dst Move from Dst to Src Move from Dst to Aux Move from Aux to Src

9
**The Tower of Hanoi (Solution)**

Move top N-1 disks from Src to Aux (using Dst as intermediary peg). Move bottom disk from source to destination. Move N-1 disks from Aux to Dst (using Src as an intermediary peg).

Similar presentations

OK

Recursion Colin Capham Recursion – an introduction to the concept.

Recursion Colin Capham Recursion – an introduction to the concept.

© 2018 SlidePlayer.com Inc.

All rights reserved.

To make this website work, we log user data and share it with processors. To use this website, you must agree to our Privacy Policy, including cookie policy.

Ads by Google