Cover Data Structures and Algorithms with Object-Oriented Design Patterns in Java
next up previous contents index

Solving Recurrence Relations-Repeated Substitution

In this section we present a technique for solving a recurrence relation such as Equation gif called repeated substitution . The basic idea is this: Given that tex2html_wrap_inline57262, then we may also write tex2html_wrap_inline57264, provided n>1. Since T(n-1) appears in the right-hand side of the former equation, we can substitute for it the entire right-hand side of the latter. By repeating this process we get

eqnarray493

The next step takes a little intuition: We must try to discern the pattern which is emerging. In this case it is obvious:

displaymath57260

where tex2html_wrap_inline57270. Of course, if we have doubts about our intuition, we can always check our result by induction:

extbfProof (By Induction). Base Case Clearly the formula is correct for k=1, since tex2html_wrap_inline57274.

Inductive Hypothesis Assume that tex2html_wrap_inline57276 for tex2html_wrap_inline57278. By this assumption

  equation498

Note also that using the original recurrence relation we can write

  equation501

for tex2html_wrap_inline57280. Substituting Equation gif in the right-hand side of Equation gif gives

eqnarray506

Therefore, by induction on l, our formula is correct for all tex2html_wrap_inline57284.

So, we have shown that tex2html_wrap_inline57276, for tex2html_wrap_inline57270. Now, if n was known, we would repeat the process of substitution until we got T(0) on the right hand side. The fact that n is unknown should not deter us--we get T(0) on the right hand side when n-k=0. That is, k=n. Letting k=n we get

  eqnarray508

where tex2html_wrap_inline57256 and tex2html_wrap_inline57258.


next up previous contents index

Bruno Copyright © 1998 by Bruno R. Preiss, P.Eng. All rights reserved.