Question: Consider the following algorithm, and let the notation [n/2] behave the same as Java's n/2. Algorithm 2: mystery(n) Input :n, a non-negative integer. Output: The

 Consider the following algorithm, and let the notation [n/2] behave the

Consider the following algorithm, and let the notation [n/2] behave the same as Java's n/2. Algorithm 2: mystery(n) Input :n, a non-negative integer. Output: The question here! 1 if n is zero then 2 | return 1 3 else L return n + mystery(In/2)) 4 What is the running time complexity of mystery (n)? a O(n/2) b. O(n) c. O(log n) Od. None of the others e. 0(1)

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!