Start learning →

A sorting algorithm is called STABLE if

Ait never crashes on adversarial inputs
Bthe order of equal-keyed elements is preserved
Cit runs in the same time on every input of size n
Dit only sorts numeric data, never strings
Answer & Solution
Correct answer: B. the order of equal-keyed elements is preserved
**Stability is about equal-keyed elements:** if Alice and Bob both have score 80 and Alice was earlier in the input, Alice stays before Bob in the sorted output. Merge sort, insertion sort, bubble sort are stable standard quick sort and heap sort are not. Crash safety, input-independence and data type are unrelated.
Practise this question with Quill — GATE CSE →

Keep practising Algorithms

Browse all Algorithms questions for GATE CSE, or explore more Computer Science topics.

Start a Algorithms lesson →
Related questions