GATE / CS ARCHIVE

GATE CSE 1999 / QUESTION 1.12

Stable sorting

Algorithms · Searching, Sorting & Selection · Full GATE CSE 1999 paper

GATE 1999, Q1.12 1 mark · MCQ
Report issue

Searching, Sorting & Selection

Question 1.12, GATE 1999: Does stable sorting mean O(n log n) time, preservation of the order of equal keys, divide-and-conquer, or O(n) space?
Tap to enlarge
Your answer
Answer & solution

Answer: B (no official key was published)

Label two records with equal key as (k,first) and (k,second), in that input order. A stable sort guarantees that first still precedes second afterward. That property matters when one field has already been sorted and a later stable pass sorts another field. Runtime, extra space and algorithmic paradigm are separate properties: a stable insertion sort may take quadratic time, while some fast sorts are unstable. Hence the definition is B.

Original paper, page 2