Question: 2. Let n E N and b > 1. We have said that the simple loop below will go through exactly rio&n] 2, the answer
2. Let n E N and b > 1. We have said that the simple loop below will go through exactly rio&n] 2, the answer is nl iterations (we usually write this iterations. In particular, when b as [log n]). while n>1 n:-n/b; end-while (a) Trace the execution for n :-25, b-3, i.e., trace the values of n. Do the same for n 5, (b) Suppose that b is replaced by b2. How does the number of iterations compare with (c) Suppose that b is replaced by Vb. How does the number of iterations compare with (d) Suppose that instead of dividing by b, we subtract b from n. How does the number of b 3/2. rlogbn)? Is it (logb n), (logb n), or O(logm)? logbn!? Is it (log n), (logm), or O(logm)? iterations connpare withlogbn!? Is it (logb n), (logbn), or O(logb n)
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
