It is required to sort a large number of records of Student detai

It is required to sort a large number of records of Student detai
| It is required to sort a large number of records of Student details of a college based on the student IDs. Assuming the records are already sorted on the basis of Student names and it is required to maintain name as the secondary sort order (similar to order by id, name in SQL), which of the following sorting algorithms is/are the most appropriate for this?

A. Merge Sort

B. Selection Sort

C. Quick Sort

D. Heap Sort

Please scroll down to see the correct answer and solution guide.

Right Answer is: A

SOLUTION

Question is implying a stable sort.

Stable sorting-:

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.

Among the ones in option

only Merge Sort is stable. So, the correct answer is option 1 .