Give the correct matching for the following pairs:
View worked solution
Answer: B
We can determine the correct matching by analyzing the worst-case time complexity of each algorithm:
- Binary Search (R): A search algorithm on a sorted array that halves the search space at each step. Its time complexity is governed by the recurrence , which yields .
- Selection (P): The selection problem (finding the -th smallest element in an unsorted array of size ) can be solved in linear time using the Median-of-Medians algorithm (or QuickSelect on average).
- Merge Sort (S): A divide-and-conquer sorting algorithm with the recurrence . Its worst-case, average-case, and best-case time complexity is .
- Insertion Sort (Q): A comparison-based sorting algorithm. In the worst case (e.g., when the input array is sorted in reverse order), it requires comparisons and shifts.
Combining these matches, we get: A-R, B-P, C-S, D-Q, which corresponds to Option B.
Free practice · Your answers on this page are not saved.
