Two way Merge Sort vs Quick sort..!!!

which sort is better Two way Merge Sort or Quick sort…??

depends on input type…but in worst case merge sort is better than quick sort…

According to me merge sort uses lots of memory to create so many arrays but not confirm about what is quick sort right?

Well… it’s name is quick sort for a reason :stuck_out_tongue:

Its all depend upon on your requirement i.e., weather you need to optimize the space more or you need to optimize the time complexity!. As quick sort is better than merge if you need to consider the space, and on other hand merge sort is better than quick in terms of time as worst case of quick sort can be go upto O(n^2). So always use both in smarty way!

Well if you are C++ programmer than better to use inbuilt function sort(…) which are generally faster then trying to implement this one externally…

Thank You!

Quicksort has O(n2) worst-case runtime and O(nlogn) average case runtime. Merge Sort O(nlogn) in both.

Typically, quicksort is significantly faster in practice than other Θ(nlogn) algorithms, because its inner loop can be efficiently implemented on most architectures, and in most real-world data, it is possible to make design choices which minimize the probability of requiring quadratic time.

Saying that it may vary according to situation.

Look at this article … Its has a good explanation of some of such cases

link text

Useful Articles …

quick-sort-vs-merge-sort

link text

in my opinion it depends upon the number of inputs. one of my friend in team outing bangalore says that merge sort is speedy. but when i use a large number of inputs i feel that the quick sort is much better than the merge sort.