1.

Which of the following sorting algorithm is stable?(a) Selection sort(b) Quick sort(c) Library sort(d) Heap sortThis question was posed to me in an internship interview.The query is from Sorting in portion Sorting of Data Structures & Algorithms II

Answer»

Correct OPTION is (C) Library sort

For explanation: Out of the given options library sort is the only algorithm which is stable. It is because the elements with IDENTICAL values appear in the same ORDER in the output array as they were in the input array.



Discussion

No Comment Found

Related InterviewSolutions