Question: Give the best lower bound that you can for the following code fragment, as a function of the initial value of n. while (n >

Give the best lower bound that you can for the following code fragment, as a function of the initial value of n.

while (n > 1)

if (ODD(n))

n = 3 * n + 1;

else n = n / 2;

Do you think that the upper bound is likely to be the same as the answer you gave for the lower bound?

Step by Step Solution

3.35 Rating (155 Votes )

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock

This is a very famous number sequence called the 3n1 conjecture or Collatz conjecture ... View full answer

blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Practical Introduction To Data Structures Questions!