What advantage does merge sort offer over other sorting algorithms in terms of stability?

  • Merge sort has a lower time complexity
  • Merge sort is an in-place sorting algorithm
  • Merge sort is inherently stable
  • Merge sort is only suitable for small datasets
Merge sort is inherently stable because it ensures that equal elements maintain their original order during the merging phase. This stability is particularly useful in scenarios where maintaining the relative order of equal elements is crucial, such as in sorting records with multiple attributes.
Add your answer
Loading...

Leave a comment

Your email address will not be published. Required fields are marked *