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](https://dsd5zvtm8ll6.cloudfront.net/si.experts.images/questions/2024/09/66f39132ef42a_45066f3913285fd6.jpg)
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
Get step-by-step solutions from verified subject matter experts
