Question: Using Big Oh notation, what is the tightest upper bound for the running time of the below function fun? def fun ( n ) :

Using Big Oh notation, what is the tightest upper bound for the running time of the below function fun?
def fun(n): # n is a positive integer
count =0
i = n
while i >0:
j =0
while j < i:
count +=1
j +=1
i //=2 # Integer division rounds down
return count
Group of answer choices
O(n^2)
Unbounded
O(n log n)
O(log n)
O(n)

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!