SLIDE 4 5/25/10 ¡ 4 ¡
13 ¡
¡Example: ¡Tower ¡of ¡Hanoi, ¡move ¡all ¡disks ¡to ¡third ¡peg ¡without ¡ever ¡
placing ¡a ¡larger ¡disk ¡on ¡a ¡smaller ¡one. ¡
14 ¡
¡Example: ¡Tower ¡of ¡Hanoi, ¡move ¡all ¡disks ¡to ¡third ¡peg ¡without ¡ever ¡
placing ¡a ¡larger ¡disk ¡on ¡a ¡smaller ¡one. ¡
15 ¡
¡Example: ¡Tower ¡of ¡Hanoi, ¡move ¡all ¡disks ¡to ¡third ¡peg ¡without ¡ever ¡
placing ¡a ¡larger ¡disk ¡on ¡a ¡smaller ¡one. ¡ ¡ ¡ ¡ ¡f(n) ¡= ¡f(n-‑1) ¡+ ¡… ¡ ¡ ¡
16 ¡
Recursive ¡Algorithms ¡
¡Example: ¡Tower ¡of ¡Hanoi, ¡move ¡all ¡disks ¡to ¡third ¡peg ¡without ¡ever ¡
placing ¡a ¡larger ¡disk ¡on ¡a ¡smaller ¡one. ¡ ¡ ¡ ¡ ¡f(n) ¡= ¡f(n-‑1) ¡+ ¡1 ¡+ ¡… ¡