Problem-1
Use the substitution method to show that
has the asymptotic upper bound
Step 1: Guess the Solution
Looking at the recurrence,
the additional work performed at each recursive call is .
Since
it is reasonable to guess that
Step 2: State the Induction Hypothesis
Assume that for all values smaller than n,
for some constant
In particular,
Step 3: Substitute into the Recurrence
Using the recurrence,
Substitute the induction hypothesis:
Step 4: Expand the Square
Recall that
Therefore,
T(n)≤c(n2−2n+1)+n.
Expanding,
Step 5: Rearrange
To prove
we require
Step 6: Choose Suitable Constants
If
then
Hence
is negative for sufficiently large values of .
For example, choosing
gives
for all
Thus,
Step 7: Verify the Base Case
Assume
Then
Choosing
satisfies the base case.
Conclusion
Since both the induction step and the base case hold,
for some constant .
Therefore,
Complete Induction Proof (Exam Style)
Given:
Guess:
Assume that
for some constant .
Then,
provided and is sufficiently large.
For the base case,
which is true for .
Hence,
Note for Students
The bound is correct but not tight. If we expand the recurrence,
so the tight asymptotic bound is
Problem-2
Use the substitution method to show that
has the asymptotic solution
Assume
Step 1: Guess the Solution
Since the problem size is reduced by half at every recursive call and only a constant amount of work is performed outside the recursive call, we guess
Step 2: State the Induction Hypothesis
Instead of writing
assume
for all
where
is a constant.
In particular,
Step 3: Substitute into the Recurrence
Suppose the constant hidden inside
is .
Then
Using the induction hypothesis,
Step 4: Simplify
Using the logarithm property
and since
we get
Expanding,
Step 5: Choose Suitable Constants
To prove
we need
This is true if
Therefore,
Thus the induction step holds.
Step 6: Verify the Base Case
Suppose
where is a constant.
Since
the hypothesis
is not true.
This is a common issue when using logarithms.
Handling the Base Case
Instead of proving the statement for
Assume
for all
Then
which is true for a sufficiently large choice of .
Thus, the induction starts at .
Conclusion
Since the induction step and the base case are satisfied,
for sufficiently large .
Hence,
Complete Proof (Exam Style)
Given
Guess
Assume
for some constant .
Then,
provided
Choose the base case holds for a sufficiently large .
Therefore,
Tight Bound (Optional)
If asked to find the tight asymptotic solution, we also prove the lower bound.
Since each recursive call performs at least a constant amount of work,
for some constant
Using a similar induction,
Combining both bounds,
This is the exact running time of Binary Search, making it a standard example of the substitution method in algorithm analysis.
Problem-3
Use the substitution method to show that
has the asymptotic upper bound
Assume
Step 1: Guess the Solution
Since this is the recurrence for Merge Sort, we guess
Step 2: State the Induction Hypothesis
Assume that for all smaller values,
for some constant
In particular,
Step 3: Substitute into the Recurrence
The recurrence is
Substitute the induction hypothesis.
Step 4: Simplify
Since
we get
Using the logarithm identity
and
we obtain
Step 5: Choose Suitable Constants
To prove
we require
This holds whenever
Hence,
Thus, the induction step is complete.
Step 6: Verify the Base Case
Choose
For
Choose
large enough so that
Hence, the base case is satisfied.
Conclusion
Since both the induction step and the base case hold,
for sufficiently large .
Therefore,
Complete Exam-Style Proof
Given
Guess
Assume
Then
provided
Choose large enough to satisfy the base case.
Hence,
Proving the Tight Bound
To show the solution is tight, we also prove the lower bound.
Assume
for some constant
Using the recurrence,
If
then
so
Thus,
Combining the upper and lower bounds,
Problem-4
Use the substitution method to show that
has the asymptotic upper bound
Step 1: Guess the Solution
Since the recurrence is similar to the Merge Sort recurrence,
we guess
for some constant
To avoid changing constants during the proof, strengthen the induction hypothesis.
Assume
where .
Then
Using
we obtain
Rearranging,
Choose . Since grows faster than ,
for sufficiently large .
Hence,
Therefore, the induction hypothesis is preserved.
Conclusion
Problem-5
Use the substitution method to show that
has the asymptotic upper bound
Step 1: Guess the Solution
Observe that
-
Each recursive call divides the problem by 3.
-
There are 2 recursive calls.
-
The work outside recursion is n.
Since
the linear term dominates. Hence, we guess
Step 2: State the Induction Hypothesis
Assume that for all smaller values,
for some constant
In particular,
Step 3: Substitute into the Recurrence
The given recurrence is
Using the induction hypothesis,
Step 4: Simplify
Factor out :
To prove
we need
Step 5: Find the Constant
Solve the inequality:
Choose
Then
Thus, the induction step is proved.
Step 6: Verify the Base Case
Assume
where is a constant.
Choose
Then
so the base case is satisfied.
Conclusion
Since both the induction step and the base case hold,
for some constant .
Therefore,
Complete Exam-Style Proof
Given
Guess
Assume
for some constant .
Then,
To satisfy
we require
which gives
Choose . The base case also holds for a sufficiently large c.
Hence,
Tight Bound
To prove the lower bound, assume
for some constant
Then,
To show
we need
This simplifies to
Choose
Hence,
Combining the upper and lower bounds,
Problem-6
Use the substitution method to show that
has the asymptotic upper bound
Assume
Step 1: Guess the Solution
Observe that
-
Number of recursive calls = 4
-
Each subproblem size =
-
Work outside recursion =
Since the recurrence is similar to one solved using the Master Theorem,
we guess
Step 2: State the Induction Hypothesis
Assume that for all smaller values,
for some constant
In particular,
Step 3: Substitute into the Recurrence
Given
substitute the induction hypothesis:
Step 4: Simplify
Since
we obtain
Step 5: Problem Encountered
We want to prove
but we obtained
The extra term prevents us from completing the proof.
This is exactly the type of situation discussed under "A trick of the trade: subtracting a low-order term."
The induction hypothesis is not strong enough.
Step 6: Strengthen the Induction Hypothesis
Instead of assuming
assume
where
Step 7: Substitute Again
Using the stronger hypothesis,
Step 8: Simplify
Expanding,
Step 9: Choose Suitable Constant
We want
Therefore,
Subtract cn2 from both sides:
Multiplying by −1 (which reverses the inequality),
Hence,
Choose
Thus,
which is exactly the strengthened induction hypothesis.
Step 10: Base Case
Suppose
Choose
large enough so that
Hence, the base case is satisfied.
Conclusion
Since the induction step and base case hold,
for suitable constants c and d.
Therefore,
Complete Exam-Style Proof
Given
Guess
The initial hypothesis
fails because
Hence, strengthen the induction hypothesis:
Assume
Then,
To satisfy
we require
which gives
Choose . The base case holds for a sufficiently large .
Hence,
Proving the Tight Bound
To show that the solution is tight, we prove a matching lower bound.
Assume
for some constant
Then,
Thus,
Combining the upper and lower bounds,
Comments
Post a Comment