Question
Assume that a mergesort algorithm in the worst case takes 30 seconds for an input of size 64. Which of the following most closely approximates the maximum input size of a problem that can be solved in 6 minutes?
Official answer and solution
- Official answer
- B
- From
- Official GATE 2015 answer key
Solution
Use the asymptotic complexity T(n) = c * n * log2(n) of mergesort to determine the maximum input size solvable in 6 minutes.
The worst-case running time of mergesort for input size is given by:
Given :
The available time is 6 minutes . We solve for :
Test the candidate input sizes:
- :
- :
- :
For , matches the available time exactly.
B
Assuming linear scaling (64 * (360/30) = 768) and ignoring the n log n factor.
The answer is the one in the official GATE answer key. The solution is this site's own explanation.
Source
- Paper
- GATE 2015 Computer Science and Information Technology (CS) Session 3
- Question
- 37 of 65, printed as CS Q.27
- Section
- Computer Science and Information Technology
Report an error in this question
GATE questions are the work of the organising institutes. This site is independent and is not affiliated with them.