This week's book giveaway is in the Kotlin forum.
We're giving away four copies of Kotlin in Action and have Dmitry Jemerov & Svetlana Isakova on-line!
See this thread for details.
Win a copy of Kotlin in Action this week in the Kotlin forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

Merge sorts efficiency  RSS feed

 
Aron Silvester
Ranch Hand
Posts: 63
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Merge sort is only efficient for sorting a small number of items if you only need to sort a large array once.

Anyone agree of disagree with this statement?
 
Winston Gutkowski
Bartender
Posts: 10573
65
Eclipse IDE Hibernate Ubuntu
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Conrado Sanchez wrote:Merge sort is only efficient for sorting a small number of items if you only need to sort a large array once.
Anyone agree of disagree with this statement?

Depends on what you mean by "efficient". It's actually more efficient, comparison-wise, than Quicksort, but less efficient in space - and possibly also in the number of moves or "swaps" it generates (don't know).

Another advantage it has is that it's stable, which can be important. Not all sort algorithms are.

HIH

Winston
 
Campbell Ritchie
Marshal
Posts: 55711
163
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Conrado Sanchez wrote:Merge sort is only efficient for sorting a small number of items if you only need to sort a large array once.
What on earth does that mean? And where did you get it from?
 
It is sorta covered in the JavaRanch Style Guide.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!