Mergesort

Merge sort is an O(n log n) worst-case comparison-based stable sorting algorithm.

Quicksort

Quicksort is a sorting algorithm invented by C

Algorithm comparisons specific

Implementation callback function

Quality | Example |
---|---|

Slower |
"When comparison function is a callback function like in quicksort libc implementation quicksort is slower than mergesort by 15 on random input and 30 for already sorted array for 64 bit integers" from question "Why is quicksort better than mergesort?" |

Consistently faster |
"When comparing my quicksort implementation with std sort on my compiler and my implementation of mergesort i noticed an odd pattern on large data sets when operating on 64 bit integers quicksort is consistently faster than mergesort" from question "Hand-coded quicksort is slower on smaller integers" |

Worst complexity stable

Others