   Chapter 11.5, Problem 9ES ### Discrete Mathematics With Applicat...

5th Edition
EPP + 1 other
ISBN: 9781337694193

#### Solutions

Chapter
Section ### Discrete Mathematics With Applicat...

5th Edition
EPP + 1 other
ISBN: 9781337694193
Textbook Problem
1 views

# Exercises 8—11 refer to the following algorithm segment. For each positive integer n, let a n be the number of iterations of the while loop. while   ( n > 0 ) n : = n   d i v   2 end while 9. Find a recurrence relation for a n .

To determine

Find a recurrence relation for an.

Explanation

Given information:

For each positive integer n, let an be the number of iterations of the while loop. while ( n > 0)

n := n div 2

end whileCalculation:

Given:

while (n>0)

n:=n div 2

end while

an = number of iteration of the while-loop when the input to the algorithm is n.

When the input to the algorithm is n, then we determine n div 2 in the first iteration of the while-loop.

n div 2=n2

We then also replace n by the value n div 2 =n2 and thus the number of iterations requires when the input is n is 1 more than the number of iterations requires when the input is n div 2=n2

### Still sussing out bartleby?

Check out a sample textbook solution.

See a sample solution

#### The Solution to Your Study Problems

Bartleby provides explanations to thousands of textbook problems written by our experts, many with advanced degrees!

Get Started 