1.

Which of the following sorting algorithm is stable?(a) Selection sort(b) Quick sort(c) Bubble sort(d) Heap sortThe question was asked in an interview.My question is taken from Sorting topic in chapter Sorting of Data Structures & Algorithms II

Answer»

Right choice is (c) Bubble sort

The best EXPLANATION: Out of the given options bubble 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