Statistically both MergeSort and QuickSort have the same average case time: O(nlog(n)); However there are various differences.
Most implementations of Mergesort, require additional scratch space, which could bash the performance. The pros of Mergesort are: it is a stable sort, and there is no worst-case scenario.
Quicksort is often implemented inplace thus saving the performance and memory by not creating extra storage space. However the performance falls on already sorted/almost sorted lists if the pivot is not randomized.
== ==
Among those three, you can automatically discard bubble sort as the worst in general cases (it actually performs quite well when the list of numbers are already in order, unlike quick sort).
In general, merge sort is O(n log n) and quick sort is O(n log n). The two main differences are that 1) quick sort can have a degradation in performance if the pivot point is chosen poorly (O(n2)), 2) quick sort does not require the extra storage that merge sort does.
While I'm not an algorithms expert, I do know that most people tend to err on the side of using quick sort. I have never actually seen anyone implement a merge sort when they had a choice.
merge sort is a stable sort, parallelizes better, and is more efficient at handling slow-to-access sequential media. Merge sort is often the best choice for sorting a linked list: in this situation it is relatively easy to implement a merge sort in such a way that it requires only Θ(1) extra space, and the slow random-access performance of a linked list makes some other algorithms (such as quicksort) perform poorly, and others (such as heapsort) completely impossible.
see related links.
There is no single answer. The reason we have so many sorting algorithms is because there is no one algorithm that meets the needs of every application. For instance, the QuickSort algorithm is capable of sorting large data sets with reasonable efficiency, but it is unstable (stable versions exist at the cost of performance) and is not suitable for sorting disk-based data (data that is too large to fit into memory all at once). Merge Sort is stable and can handle disk-based data more efficiently, but for memory-based data, a QuickSort will generally be faster. By contrast, Insert Sort and Selection Sort are much better suited to sorting small data sets.
Hybrid sorts (a combination of two or more algorithms) are more generalised algorithms, providing a reasonable compromise between speed, stability and efficiency. For instance, a stable version of QuickSort can be used to divide the set into smaller and smaller partitions until a partition is small enough to be handled by an Insertion Sort. Intro Sort is an example of a hybrid algorithm.
It should be noted that Bubble Sort has no practical applications whatsoever. It is often cited as an example of how not to write an algorithm. However, a single-pass Bubble Sort is an efficient means of determining if a set is already sorted (immediately terminating if any pair of elements are in the wrong order). By definition, a sorting algorithm that does not actually sort anything cannot be regarded as being a sorting algorithm.
quick sort doesn't require extra storage than merge sort dose
quick sort is better,bcoz it doesn't take extra space of memory...
quick sort
Comolexity Not efficent big data
types of sorting in c language are: insertion sort selection sort bubble sort merge sort two way merge sort heap sort quick sort
Never. Bubble sort is often cited as an example of how not to write a sorting algorithm and is used purely as a programming exercise. It is never used in production code. Although reasonably efficient when sorting small lists, an insertion sort performs better on average. But for larger lists it has no practical uses. A merge sort is better for large lists, but if stability isn't an issue a quick sort is even better. Hybrid sorts typically use quick sort until a partition is small enough for an insertion sort to complete the job.
There is no key element in a merge sort. Unlike quick sort which requires a key element (a pivot) to recursively divide a subset into two subsets, merge sort simply divides a subset into subsets of 1 element and merges adjacent subsets together to produce sorted subsets. When there is only one subset remaining, the subset is fully sorted.
quicksort should be O(n^2), but merge sort should be O(nlogn). but if you can modify partition algorithm with checking all values same in array from p to r, it could be O(nlogn).
it has less complexity
Comolexity Not efficent big data
types of sorting in c language are: insertion sort selection sort bubble sort merge sort two way merge sort heap sort quick sort
insertion,bubble,quick, quick3, merge, shell,heap, selection sorting
Never. Bubble sort is often cited as an example of how not to write a sorting algorithm and is used purely as a programming exercise. It is never used in production code. Although reasonably efficient when sorting small lists, an insertion sort performs better on average. But for larger lists it has no practical uses. A merge sort is better for large lists, but if stability isn't an issue a quick sort is even better. Hybrid sorts typically use quick sort until a partition is small enough for an insertion sort to complete the job.
There is no key element in a merge sort. Unlike quick sort which requires a key element (a pivot) to recursively divide a subset into two subsets, merge sort simply divides a subset into subsets of 1 element and merges adjacent subsets together to produce sorted subsets. When there is only one subset remaining, the subset is fully sorted.
quicksort should be O(n^2), but merge sort should be O(nlogn). but if you can modify partition algorithm with checking all values same in array from p to r, it could be O(nlogn).
Quick sort runs the loop from the start to the end everytime it finds a large value or a small value while in merge sort starts from the first position of the array and assembles the large or small numbers in one side in just one loop so its more faster than quick sort
Merge sort is good for large data sets, while insertion sort is good for small data sets.
The reason we have so many sorting techniques is that there is no "best." Depending on circumstances, your best bet will usually be either quick sort or merge sort.
Because the quick sort can be used for large lists but selection not. selection sort is used to find the minimum element ,but quick choose element called pivot and move all smaller nums before it & larger after it.
shell uses an odd number,merge uses an even number?