GATE CS 2017, set 2 · Question 3 · Algorithms · Multiple choice (MCQ) · 1 mark · −1/3 for a wrong answer
Match the algorithms with their time complexities:
| Algorithm | Time complexity |
|---|---|
| (P) Towers of Hanoi with n disks | (i) Θ(n²) |
| (Q) Binary search given n sorted numbers | (ii) Θ(n log n) |
| (R) Heap sort given n numbers at the worst case | (iii) Θ(2ⁿ) |
| (S) Addition of two n × n matrices | (iv) Θ(log n) |
- (A) P → (iii), Q → (iv), R → (i), S → (ii)
- (B) P → (iv), Q → (iii), R → (i), S → (ii)
- (C) P → (iii), Q → (iv), R → (ii), S → (i)
- (D) P → (iv), Q → (iii), R → (ii), S → (i)
Answer
Answer (C)
Answer from the official GATE CS 2017 answer key.
The step-by-step solution, where available, is part of GATE CS Pro. See what Pro includes