7

Is merge sort stable? I read it in a book which says merge sort is stable as long as the merge operation implemented properly. Is that true?

David Heffernan
  • 601,492
  • 42
  • 1,072
  • 1,490
Mr.Php
  • 109
  • 1
  • 1
  • 6
  • read the wiki page... – Mitch Wheat Feb 23 '13 at 04:38
  • It's not an in place sorting algorithm, so perhaps by requiring a larger chunk of memory we can say it is as unstable as the memory it requires. – Rey Gonzales Feb 23 '13 at 04:38
  • @ReyGonzales I don't think that's what were talking about when we are assessing the stability of a sorting algorithm. And even then, most sorting algorithms that are not in place tend to be stable, such as merge sort. – Sal Rahman Nov 07 '16 at 06:06

1 Answers1

8

true. It depends on how you properly implement the merge sort. http://en.wikipedia.org/wiki/Stable_sort#Stability

NinjaV
  • 127
  • 1
  • 10