Does quicksort use more comparisons than merge sort? Why is it faster if it uses more comparisons?
1
Expert's answer
2012-04-03T11:36:38-0400
For each type there are sorting your best / average / worst case. 1) worst case 2) the average case 3) The best case
Merge sort has the properties: 1) NlogN - the elements are taken alternately 2) NlogN - a random array, which is not better or worse 3) NlogN - the array elements are arranged so that at the confluence of sub-arrays are first written elements of the first subarray and then the elements of the second subarray
The bubble sort has the properties: An N ^ 2 - array sorted in reverse order with respect to the desired 2 N ^ 2 - a random array, which is not better or worse 3 N ^ 2 - the array is sorted according to specified criteria / / In the best case, the optimization of H
Therefore it is quicker to judge - it is impossible. At great length arrays show a sort very well. And the same sort on an array of small length is much longer than the usual bubble sort
Numbers and figures are an essential part of our world, necessary for almost everything we do every day. As important…
APPROVED BY CLIENTS
Finding a professional expert in "partial differential equations" in the advanced level is difficult.
You can find this expert in "Assignmentexpert.com" with confidence.
Exceptional experts! I appreciate your help. God bless you!
Comments
Leave a comment