# Algorithms | Analysis of Algorithms (Recurrences) | Question 11

Consider the following recurrence:

Which one of the following is true?

(A) T(n) = (loglogn)

(B) T(n) = (logn)

(C) T(n) = (sqrt(n))

(D) T(n) = (n)

**(A)** A

**(B)** B

**(C)** C

**(D)** D

**Answer:** **(B)** **Explanation:** This question can be solved by first change of variable and then Master Method.

Let n = 2^m T(2^m) = T(2^(m/2)) + 1 Let T(2^m) = S(m) S(m) = 2S(m/2) + 1

Above expression is a binary tree traversal recursion whose time complexity is (m). You can also prove using Master theorem.

S(m) = (m) = (logn) /* Since n = 2^m */

Now, let us go back to the original recursive function T(n)

T(n) = T(2^m) = S(m) = (Logn)

## Recommended Posts:

- Algorithms | Analysis of Algorithms (Recurrences) | Question 8
- Algorithms | Analysis of Algorithms (Recurrences) | Question 7
- Algorithms | Analysis of Algorithms (Recurrences) | Question 9
- Algorithms | Analysis of Algorithms (Recurrences) | Question 11
- Algorithms | Analysis of Algorithms (Recurrences) | Question 3
- Algorithms | Analysis of Algorithms (Recurrences) | Question 11
- Algorithms | Analysis of Algorithms (Recurrences) | Question 6
- Algorithms | Analysis of Algorithms (Recurrences) | Question 4
- Algorithms | Analysis of Algorithms (Recurrences) | Question 2
- Algorithms | Analysis of Algorithms (Recurrences) | Question 1
- Algorithms | Analysis of Algorithms | Question 8
- Algorithms | Analysis of Algorithms | Question 3
- Algorithms | Analysis of Algorithms | Question 9
- Algorithms | Analysis of Algorithms | Question 2
- Algorithms | Analysis of Algorithms | Question 10