Match List I (recurrence) with List II (complexity). List I: (A) T(n) = 2T(n/2) + n, (B) T(n) = T(n/2) + 1, (C) T(n) = 2T(n/2) + 1, (D) T(n) = T(n−1) + n. List II: (I) T(n) = Θ(n log n) (exact), (II) O(n²), (III) T(n) = Θ(n) (exact), (IV) O(n).
Pick an option to check yourself, or open the answer below.
Show answer & explanation
Correct answer: A. (A)-(I), (B)-(IV), (C)-(III), (D)-(II)
Explanation
2T(n/2) + n = Θ(n log n) (I). T(n/2) + 1 = Θ(log n), which is O(n) (IV) but not Θ(n). 2T(n/2) + 1 = Θ(n) exactly (III). T(n−1) + n = Θ(n²), i.e. O(n²) (II). That is option A.
Note on the official key: the official key says option C. Official/PW key is C, which pairs T(n) = T(n/2) + 1 with Θ(n) (exact). That recurrence is Θ(log n), so the pairing in option A is the correct one.
More Data Structures and Algorithms questions
- Let n be the least integer such that f(x) is O(xⁿ). Arrange the following functions in increasing order of n: A. f(x) = 3x³ + (log x)⁴ B. f…
- Match List - I with List - II. f(n) = a f(n / b) + g(n) is a divide-and- conquer recurrence relation for the Listed-I algorithms, match the…
- The height of a binary search tree for the words banana, peach, apple, pear, coconut, mango and papaya using alphabetical order is :
- How much time does an algorithm using 2⁵⁰ bit operations need if each bit operation takes 2⁻³⁸ seconds?
- A lower-triangular sparse matrix is one :
- Arrange the following prefix expressions by value in increasing order: A. + − * 2 / 8 4 3 2 B. ↑ − * 3 3 * 4 2 5 C. + − ↑ 3 2 ↑ 2 3 / 6 − 4…