f(n) = a·f(n/b) + g(n) is a divide-and-conquer recurrence. Match the algorithms in List I with their recurrences in List II.
| List I | List II |
|---|---|
| A. Binary Search | I. f(n) = 7f(n/2) + 15n²/4 |
| B. Find maximum and minimum of a sequence | II. f(n) = 2f(n/2) + n |
| C. Merge Sort | III. f(n) = 2f(n/2) + 2 |
| D. Fast Matrix Multiplication | IV. f(n) = f(n/2) + 2 |
Pick an option to check yourself, or open the answer below.
Show answer & explanation
Correct answer: D. A-IV, B-III, C-II, D-I
Explanation
Binary search: f(n) = f(n/2) + 2 (IV). Max & min: f(n) = 2f(n/2) + 2 (III). Merge sort: f(n) = 2f(n/2) + n (II). Fast (Strassen) matrix multiplication: f(n) = 7f(n/2) + 15n²/4 (I).More Data Structures and Algorithms questions
- The height of a binary search tree built by inserting the words banana, peach, apple, pear, coconut, mango and papaya (in this order, alpha…
- 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 in increasing order of their values: A. + − * 2 / 8 4 3 2 B. ↑ − * 3 3 * 4 2 5 C. + − ↑ 3 2 ↑ 2 3…
- Which of the following are true for a complete (full) binary tree? A. It always has an odd number of vertices. B. With i internal vertices,…
- In a ______ the left and right subtrees of some node differ in height by more than one.