The GATE Grind

GATE 2015 CS (CS3) – Question 37

Algorithms · Asymptotic Analysis and Time/Space Complexity · 2 marks · Multiple choice

Worst-case mergesort takes 30 seconds for input size 64. Which best approximates the maximum size sortable in six minutes?

  1. 256
  2. 512
  3. 1024
  4. 2048

Practise this question in The GATE Grind →

Show answer and explanation

Correct answer: (B) 512

Explanation

Model time as c n log₂n. Six minutes is twelve times thirty seconds, so the target n log₂n is 12×64×6=4608. At n=512, n log₂n=512×9=4608 exactly. Thus B is the matching size under the stated asymptotic model.

More Asymptotic Analysis and Time/Space Complexity questions

All Asymptotic Analysis and Time/Space Complexity questions →