This question was previously asked in

CIL MT Systems: 2020 Official Paper

- A sorting algorithm is stable if it doesn’t preserve the order of duplicate keys
- A sorting algorithm is stable if it preserves the order of duplicate keys
- A sorting algorithm is stable if it preserves the order of all keys
- A sorting algorithm is stable if it preserves the order of non-duplicate keys

Option 2 : A sorting algorithm is stable if it preserves the order of duplicate keys

__Concept __

The stability of a sorting algorithm is concerned with how the algorithm treats equal (or repeated) elements.

A sorting algorithm is said to be stable if two objects with equal keys appear in the same order in sorted output as they appear in the input array to be sorted.

Some sorting algorithms are stable by nature like Insertion sort, Merge Sort, Bubble Sort, etc. And some sorting algorithms are not, like Heap Sort, Quick Sort, etc.

India’s **#1 Learning** Platform

Start Complete Exam Preparation

Daily Live MasterClasses

Practice Question Bank

Mock Tests & Quizzes

Trusted by 2,19,06,017+ Students

Testbook Edu Solutions Pvt. Ltd.

1st & 2nd Floor, Zion Building,

Plot No. 273, Sector 10, Kharghar,

Navi Mumbai - 410210

[email protected]
Plot No. 273, Sector 10, Kharghar,

Navi Mumbai - 410210

Toll Free:1800 833 0800

Office Hours: 10 AM to 7 PM (all 7 days)