Which of the following is the solution of the following recurrence relation T(n) = T(2n/3) + 1?
θ (log n)
Recurrences of the form T(n) = aT(n/b) + f(n) are solved with the Master theorem by comparing f(n) with \(n^{\log_b a}\).
Step 1 — Rewrite T(n) = T(2n/3) + 1 as a = 1, \(b = \frac{3}{2}\), f(n) = 1.
Step 2 — \(n^{\log_{3/2} 1} = n^{0} = 1\), so f(n) = Θ(1) matches it exactly (case 2).
Step 3 — Case 2 gives \(T(n) = \Theta(n^{0}\log n) = \Theta(\log n)\).
Check by unrolling: each step multiplies n by 2/3 and adds 1, so after k steps \(T(n) = T\left(\left(\frac{2}{3}\right)^{k} n\right) + k\); the argument reaches 1 when \(k = \log_{3/2} n\), giving Θ(log n).
The polynomial bounds n2, n3/2 and n log n would need many subproblems or a large non-recursive cost; here there is only one subproblem and constant extra work per level.
θ (log n) option is correct.
The solution of the recurrence relation
\(T(n) \le \begin{cases} \theta(1) & \text{if } n \le 80 \\ T\left(\frac{n}{s}\right) + T\left(\frac{7n}{10} + 6\right) + O(n) & \text{if } n \gt 80 \end{cases}\)
is :
The solution of the recurrence relation of \(T(n) = 3T\left(\text{floor}\left(\frac{n}{4}\right)\right) + n\) is
The asymptotic upper bound solution of the recurrence relation given by
\(T(n) = 2T\left(\frac{n}{2}\right) + \frac{n}{lg\ n}\) is :
A recursive function h, is defined as follows :
h(m) = k, if m = 0
= 1, if m = 1
= 2 h(m – 1) + 4h(m – 2), if m ≥ 2
If the value of h(4) is 88 then the value of k is :
Arrange the following recurrence relations in increasing order of their time capacity.
(A) T(n) = T(n/2) + 1
(B) T(n) = 2T(n/2) + n
(C) T(n) = 3T(n/3) + n
(D) T(n) = 2T(n/2) + √n
(E) T(n) = T(n − 1) + 1
Choose the correct answer from the options given below :
Match List - I with List - II.
| List - I (Recurrence Relations) | List - II (Complexity) |
|---|---|
| (A) T(n) = 2T(n/2) + n | (I) T(n) = θ(n logn) {exact solution} |
| (B) T(n) = T(n/2) + 1 | (II) O(n2) |
| (C) T(n) = 2T(n/2) + 1 | (III) T(n) = θ(n) {exact solution} |
| (D) T(n) = T(n − 1) + 1 | (IV) O(n) |
Choose the correct answer from the options given below :
The solution of the recurrence relation
\(T(n) \le \begin{cases} \theta(1) & \text{if } n \le 80 \\ T\left(\frac{n}{s}\right) + T\left(\frac{7n}{10} + 6\right) + O(n) & \text{if } n \gt 80 \end{cases}\)
is :
The solution of the recurrence relation of \(T(n) = 3T\left(\text{floor}\left(\frac{n}{4}\right)\right) + n\) is
The asymptotic upper bound solution of the recurrence relation given by
\(T(n) = 2T\left(\frac{n}{2}\right) + \frac{n}{lg\ n}\) is :
A recursive function h, is defined as follows :
h(m) = k, if m = 0
= 1, if m = 1
= 2 h(m – 1) + 4h(m – 2), if m ≥ 2
If the value of h(4) is 88 then the value of k is :
Divide and Conquer is an algorithmic paradigm that solves problems by: