Question: Homework 2 problem # 4 b seems to be an infinite loop for any input greater than 1 . If so , Big O would

Homework 2 problem #4b seems to be an infinite loop for any input greater than 1. If so, Big O would not apply (because the program does not terminate). Is anyone else seeing the same or am I misunderstanding?
int i=n;
while )>(1
{
5; I/ Assume S's time complexity is O(1)
i=i*2;
};
 Homework 2 problem #4b seems to be an infinite loop for

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock 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 Databases Questions!