{[ promptMessage ]}

Bookmark it

{[ promptMessage ]}

L11_RecurInduction

L11_RecurInduction - COMP170 Discrete Mathematical Tools...

Info iconThis preview shows pages 1–29. Sign up to view the full content.

View Full Document Right Arrow Icon
1-1 COMP170 Discrete Mathematical Tools for Computer Science Discrete Math for Computer Science K. Bogart, C. Stein and R.L. Drysdale Section 4.2, pp. 143-153 Recursion, Recurrences and Induction Version 2.0: Last updated, May 13, 2007 Slides c 2005 by M. J. Golin and G. Trippen
Background image of page 1

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full Document Right Arrow Icon
2-1 Recursion, Recurrences and Induction Recursion Recurrences Iterating a Recurrence Geometric Series First-Order Linear Recurrences
Background image of page 2
3-1 Recursion
Background image of page 3

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full Document Right Arrow Icon
3-2 Recursion Recursive computer programs or algorithms often lead to inductive analyses
Background image of page 4
3-3 Recursion Recursive computer programs or algorithms often lead to inductive analyses A classic example of this is the Towers of Hanoi problem
Background image of page 5

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full Document Right Arrow Icon
4-1 Towers of Hanoi
Background image of page 6
4-2 Towers of Hanoi
Background image of page 7

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full Document Right Arrow Icon
4-3 Towers of Hanoi 3 pegs; n disks of different sizes. A legal move takes a disk from one peg and moves it onto another peg so that it is not on top of a smaller disk Problem: Find a (efficient) way to move all of the disks from one peg to another
Background image of page 8
5-1 Towers of Hanoi
Background image of page 9

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full Document Right Arrow Icon
5-2 Towers of Hanoi legal move
Background image of page 10
5-3 Towers of Hanoi legal move legal move
Background image of page 11

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full Document Right Arrow Icon
5-4 Towers of Hanoi legal move legal move not legal
Background image of page 12
5-5 Towers of Hanoi legal move legal move not legal legal move
Background image of page 13

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full Document Right Arrow Icon
6-1 Towers of Hanoi Problem
Background image of page 14
6-2 Towers of Hanoi Start with n disks on leftmost peg Problem
Background image of page 15

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full Document Right Arrow Icon
6-3 Towers of Hanoi Start with n disks on leftmost peg using only legal moves Problem
Background image of page 16
6-4 Towers of Hanoi Start with n disks on leftmost peg using only legal moves Problem move all disks to rightmost peg.
Background image of page 17

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full Document Right Arrow Icon
6-5 Towers of Hanoi Start with n disks on leftmost peg using only legal moves Given i, j ∈ { 1 , 2 , 3 } let { i, j } = { 1 , 2 , 3 } - { i } - { j } Problem move all disks to rightmost peg. i.e., { 1 , 2 } = 3 , { 1 , 3 } = 2 , { 2 , 3 } = 1 .
Background image of page 18
7-1 Towers of Hanoi General Solution
Background image of page 19

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full Document Right Arrow Icon
7-2 Towers of Hanoi Recursion Base: If n = 1 moving one disk from i to j is easy. Just move it. General Solution
Background image of page 20
This is the end of the preview. Sign up to access the rest of the document.

{[ snackBarMessage ]}