Exercises 8—11 refer to the following algorithm segment. For each positive integer n, let be the number of iterations of the while loop.
10. Find a explict formula for .
Find an explicit formula for an.
For each positive integer n, let an be the number of iterations of the while loop. while ( n > 0)
n n div 2
We know that (from pervious exercise)
Let us determine the first terms of the given recurrence relation:
We then note that appear to be true for these values of n, which we will proof is true.
PROOF BY STRONG INDUCTION:
Basis step: n = 1
Thus P (1) is true.
We need to prove that P ( k + 1) is true.
FIRST CASE: k odd
Since k is odd, k + 1 is even and thus ( k + 1) / 2 is an integer
Bartleby provides explanations to thousands of textbook problems written by our experts, many with advanced degrees!Get Started