Which of the following sorting algorithm is stable?

Which of the following sorting algorithm is stable?
A. Tim sort
B. Introsort
C. Quick sort
D. Heap sort
 
Answer: a
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.
 

Tìm kiếm

Back
Top