rec20 - CS 3110 Recitation 20 Using the substituion and...

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

View Full Document Right Arrow Icon
CS 3110 Recitation 20 Using the substituion and master methods Using the substituion method The substitution method is a condensed way of proving an asymptotic bound on a recurrence by induction. In the substitution method, instead of trying to find an exact closed-form solution, we only try to find a closed- form bound on the recurrence. This is often much easier than finding a full closed-form solution, as there is much greater leeway in dealing with constants. The substitution method is a powerful approach that is able to prove upper bounds for almost all recurrences. However, its power is not always needed; for certain types of recurrences, the master method (see below) can be used to derive a tight bound with less work. In those cases, it is better to simply use the master method, and to save the substitution method for recurrences that actually need its full power. Note that the substitution method still requires the use of induction. The induction will always be of the same basic form, but it is still important to state the property you are trying to prove, split into one or more base cases and the inductive case, and note when the inductive hypothesis is being used. Substitution method example Consider the following reccurence relation, which shows up fairly frequently for some types of algorithms: T (1) = 1 T ( n ) = 2 T ( n -1) + c 1 By expanding this out a bit (using the "iteration method"), we can guess that this will be O(2 n ). To use the substitution method to prove this bound, we now need to guess a closed-form upper bound based on this asymptotic bound. We will guess an upper bound of k 2 n - b , where b is some constant. We include the b in anticipation of having to deal with the constant c 1 that appears in the recurrence relation, and because it does no harm. In the process of proving this bound by induction, we will generate a set of constraints on k and b , and if b turns out to be unnecessary, we will be able to set it to whatever we want at the end. Our property, then, is T ( n ) ≤ k 2 n - b , for some two constants k and b . Note that this property logically implies that T ( n ) is O(2 n ), which can be verified with reference to the definition of O. Base case:
Background image of page 1

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

View Full DocumentRight Arrow Icon
Image of page 2
This is the end of the preview. Sign up to access the rest of the document.

Page1 / 5

rec20 - CS 3110 Recitation 20 Using the substituion and...

This preview shows document pages 1 - 2. Sign up to view the full document.

View Full Document Right Arrow Icon
Ask a homework question - tutors are online