Professional Documents
Culture Documents
Concrete Mathematic: This Study Resource Was Shared Via
Concrete Mathematic: This Study Resource Was Shared Via
vi
Concrete Mathematic
ed
ar
sh
Recurrence
as
w
m e
co rc
o. sou
re
dy
This study source was downloaded by 100000797176042 from CourseHero.com on 06-08-2021 05:26:21 GMT -05:00
Tower Of Hanoi - Minimum Number
of Move
• let's consider what happens if there are n disks.
a
vi
• Tn is the minimum number of move needed
ed
• look at small cases first
ar
• T0 = 0
sh
• T1 = 1
as
w
• T2 = 3
m e
• Tn = ?
co rc
o. sou
re
dy
This study source was downloaded by 100000797176042 from CourseHero.com on 06-08-2021 05:26:21 GMT -05:00
Tower Of Hanoi – Derive Tn
a
vi
moves.
ed
• Move the largest A to C in 1 move.
ar
sh
• Finally transfer the n - 1 smallest from B to C using A
as
with Tn-1 moves.
w
m e
• Thus we can transfer n disks (for n > 0) in at most co rc
o. sou
• Tn = 2Tn-1 + 1 moves for n > 0
re
dy
This study source was downloaded by 100000797176042 from CourseHero.com on 06-08-2021 05:26:21 GMT -05:00
Tower Of Hanoi - Recurrence
• The solution of minimum move for Tower of Hanoi is
a
vi
• T0 = 0
ed
ar
• Tn = 2Tn-1 + 1 moves for n > 0
sh
• A set of equalities like this is called a recurrence (a.k.a.
as
w
recurrence relation or recursion relation).
m e
• It gives a boundary value and an equation for the co rc
o. sou
general value in terms of earlier ones.
re
dy
This study source was downloaded by 100000797176042 from CourseHero.com on 06-08-2021 05:26:21 GMT -05:00
Tower Of Hanoi – Close Form
• Is there any close form for Tn?
a
vi
• T3 = 2·3 + 1 = 7; T4 = 2·7 + 1 = 15; T5 = 2·15 + 1 = 31; T6
ed
ar
= 2·31 + 1 = 63
sh
• So Tn = 2n – 1?
as
w
• We can use Mathematical Induction to prove this.
m e
co rc
o. sou
re
dy
This study source was downloaded by 100000797176042 from CourseHero.com on 06-08-2021 05:26:21 GMT -05:00
Tower Of Hanoi - Mathematical
Induction
Number of minimum move needed
•-> 2^n -1
Basis:
a
• LHS= number of minimum move needed for 0 disk
vi
ed
=0
ar
sh
• RHS = 2^n -1
as
= 2^0-1
w
m e
=1-1 =0 co rc
o. sou
re
dy
This study source was downloaded by 100000797176042 from CourseHero.com on 06-08-2021 05:26:21 GMT -05:00
Tower Of Hanoi - Mathematical
Induction
Number of minimum move needed
-> 2^n -1
a
• Induction:
vi
ed
Tn = 2Tn-1 + 1 = 2^n -1 true
ar
We have to prove that, Tn +1 = 2^(n+1) -1
sh
as
Tn +1 = 2Tn + 1
w
= 2 * ( 2n – 1) + 1
m e
= 2 * 2n – 2 + 1 co rc
o. sou
= 2n+1 – 1
re
dy
This study source was downloaded by 100000797176042 from CourseHero.com on 06-08-2021 05:26:21 GMT -05:00
Solving Recurrence
1. Look at small cases. This gives us insight into the
a
vi
problem and helps us in stages 2 and 3.
ed
ar
2. Find and prove a mathematical expression for the
sh
quantity of interest.
as
w
3. Find and prove a closed form for our mathematical
m e
expression. co rc
o. sou
re
dy
This study source was downloaded by 100000797176042 from CourseHero.com on 06-08-2021 05:26:21 GMT -05:00
Powered by TCPDF (www.tcpdf.org)