Match the following algorithm with its average complexity. Algorithm Average…
2023
Match the following algorithm with its average complexity.
Algorithm | Average Complexity |
I. Binary search | 1. O(n²) |
II. Quick sort | 2. O(log n) |
III. Linear search | 3. O(n log n) |
IV. Selection sort | 4. O(n) |
- A.
I - 4; II - 3; III - 2; IV - 1
- B.
I - 2; II - 3; III - 4; IV - 1
- C.
I - 1; II - 4; III - 2; IV - 3
- D.
I - 3; II - 1; III - 2; IV - 4
Attempted by 132 students.
Show answer & explanation
Correct answer: B
Average complexities are: binary search O(log n), quick sort O(n log n), linear search O(n), and selection sort O(n^2). This matches I-2, II-3, III-4, IV-1.