Question: The pseudo-code below gives an algorithm to computelog_2 n, assuming that n is an integer such thatn1. Select the recurrence relation that describes the complexity
The pseudo-code below gives an algorithm to computelog_2 n, assuming that n is an integer such thatn1. Select the recurrence relation that describes the complexity of the algorithm as a function of n, the input integer.
LogCeil(n)
If (n = 1), Return(0)
m := n/2
y := LogCeil(m)
Return(y + 1)
A) T(n)=2T(n/2)+(1)
B) T(n)=T(n-1)+(1)
C) T(n)=T(n/2)+(1)
D) T(n)=2T(n-1)+(1)
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
