1.

Which of the following sorting algorithm is stable?(a) Tim sort(b) Introsort(c) Quick sort(d) Heap sortThis question was addressed to me during an internship interview.Origin of the question is Sorting in portion Sorting of Data Structures & Algorithms II

Answer»

The correct answer is (a) Tim sort

Easiest explanation - Out of the GIVEN OPTIONS Tim sort is the only ALGORITHM which is stable. As both CONSTITUENTS of Tim sort (I.e insertion sort and merge sort) are stable so Tim sort ALSO becomes stable.



Discussion

No Comment Found

Related InterviewSolutions