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

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 Mathematics Questions!