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

Presentation is loading. Please wait....

OK

CS1010: Programming Methodology

CS1010: Programming Methodology

© 2018 SlidePlayer.com Inc.

All rights reserved.

To ensure the functioning of the site, we use **cookies**. We share information about your activities on the site with our partners and Google partners: social networks and companies engaged in advertising and web analytics. For more information, see the Privacy Policy and Google Privacy & Terms.
Your consent to our cookies if you continue to use this website.

Ads by Google

Ppt on 2 stroke ic engine plans Ppt on interest rate parity Ppt on number system for class 9 Ppt on storage devices of computer Ppt on media and entertainment industry Ppt on tea industry in india Ppt on network switches Ppt on 3 allotropes of carbon Ppt on duty roster designs Ppt on power system harmonics analysis