GATE 2017 CS (CS2) – Question 13
Match (P) Towers of Hanoi with n disks, (Q) binary search on n sorted numbers, (R) worst-case heap sort on n numbers, (S) addition of two n×n matrices, with (i) Θ(n²), (ii) Θ(n log n), (iii) Θ(2ⁿ), (iv) Θ(log n).
Practise this question in The GATE Grind →
Show answer and explanation
Correct answer: (C) P–iii,Q–iv,R–ii,S–i
Explanation
Hanoi uses 2ⁿ−1 moves, Θ(2ⁿ). Binary search halves its search interval, Θ(log n). Heap sort extracts n maxima at logarithmic cost, Θ(n log n). Matrix addition visits n² entries, Θ(n²). Therefore P–iii,Q–iv,R–ii,S–i, C.
More Asymptotic Analysis and Time/Space Complexity questions
- GATE 2017 CS (CS2) Q40
- GATE 2017 CS (CS2) Q48
- GATE 2012 CS (CS1) Q15
- GATE 2012 CS (CS1) Q28
- GATE 2013 CS (CS1) Q40
- GATE 2013 CS (CS1) Q41
All Asymptotic Analysis and Time/Space Complexity questions →