30 likes | 740 Views
Recurrence Relation for the Towers of Hanoi. N No.Moves 1 1 2 3 3 7 4 15 5 31. Given: T(1) = 1 T(n) = 2 T( n-1 ) +1. T(n) = 2 T( n-1 ) +1. T(n) = 2 +1. T(n) = 2 [ 2 T(n-2) + 1 ] +1.
E N D
Recurrence Relation for the Towers of Hanoi N No.Moves 1 1 2 3 3 7 4 15 5 31 Given: T(1) = 1 T(n) = 2 T( n-1 ) +1
T(n) = 2 T( n-1 ) +1 T(n) = 2 +1 T(n) = 2 [ 2 T(n-2) + 1 ] +1 T(n) = 2 [ 2 + 1 ] +1 T(n) = 2 [ 2 [ 2 T(n-3) + 1 ]+ 1 ] +1 T(n) = 2 [ 2 [ 2 [ 2 T( n-4 ) + 1 ] + 1 ]+ 1 ] +1 T(n) = 24 T ( n-4 ) + 15 . . . T(n) = 2k T ( n-k ) + 2k - 1 Since n is finite, k -> n. Therefore, lim T(n) k -> n = 2n - 1