GateAI
Searching, Sorting and Hashing

GATE CSE 2012 · Q39

MCQ2 marksMedium

Time

A list of nn strings, each of length nn, is sorted into lexicographic order using the merge-sort algorithm. The worst case running time of this computation is

Select one answerSingle correct

Pick an option to check

Solution

Step-by-step verified solution

Official answer: See verified solution

Searching, Sorting and Hashing
  1. Standard merge-sort sorts a list of nn elements using O(nlog⁡n)O(n \log n) comparisons.

  2. In this problem, each element is a string of length nn. Comparing two strings of length nn takes O(n)O(n) time in the worst case.

  3. Therefore, the worst-case time complexity of merge-sort on nn strings of length nn is:

    T(n)=O(nlog⁡n)×O(n)=O(n2log⁡n)T(n) = O(n \log n) \times O(n) = O(n^2 \log n)

*Note*: In the official answer key for Paper CS Code A, this question was awarded Marks to All (though in some codes it was marked as option B).

Try the question first, then check your work.

Think the official key or this write-up is wrong?

Report error or challenge

Examiner trap

The misconception this question tests

This Searching, Sorting and Hashing previous year question is Q39 of the GATE CSE 2012 paper. Find more GATE CSE PYQs on Searching, Sorting and Hashing in Algorithms, or browse all GATE CSE PYQs.

Free diagnostic

Where do you stand for GATE?

Take the 20-minute diagnostic: the 3 topics that cost you the most marks, and a rank range. Or sit 5 related Searching, Sorting and Hashing PYQs now with no account.

One GATE CSE PYQ every morning

An official question by email at 7 AM IST, with a link to its verified solution. Unsubscribe in one click.

Searching, Sorting and Hashing in GATE CSE

Searching, Sorting and Hashing has 27 GATE CSE PYQs across 20 papers from 2012 to 2026. 7 of them are 2-mark MCQs like this one, and it is the only one in GATE CSE 2012.

How GATE tests Searching, Sorting and Hashing

More from GATE CSE 2012

Share this solution

A plain-text card for WhatsApp or Telegram study groups.

GateAI solution cardGATE CSE 2012 · Q39 · MCQ

A list of n strings, each of length n, is sorted into lexicographic order using the merge-sort algorithm. The worst case running time of this computation is

Topic-wise GATE CS PYQs with verified steps

Independent practice explanation verified by the GateAI team. GATE is conducted by the IITs; question text follows the official paper.