Question: Given the following code fragment: for (int i = n; i > n; i=i/2) sum++; What would the big-o notation be? Please explain why
Given the following code fragment: for (int i = n; i > n; i=i/2) sum++; What would the big-o notation be? Please explain why or how you got to that answer: i. O(log n) ii. O(n) iii. O(n/2) iv. O(2^n)
Step by Step Solution
3.46 Rating (162 Votes )
There are 3 Steps involved in it
The detailed answer for the above question is provided below The provided code fragment contains a l... View full answer
Get step-by-step solutions from verified subject matter experts
