You are on page 1of 2

Branden Olson

CSCI 3104 Algorithms


Mar. 3, 2013

Mergesort versus Quicksort


Sorting algorithms never fail to exemplify the key concepts of
algorithms, and how the same problem can be solved in different ways,
or even how the same algorithm can have different implementations.
Sorting is especially interesting because there are more ways to sort a
list than most people might guess, and two of the most creative sorting
algorithms, mergesort and quicksort, are actually two of the most
efficient out there.
Mergesort and quicksort have garnered much attention because
of their ability to sort a list in O(n log n) time. While quicksort has O(n)
worst-case complexity, its average case in O(n log n) rarely
degenerates as such. So why choose one over another? In fact, while
both algorithms are in O(n log n) for average-case complexity,
quicksort is in O(1) in terms of space, while mergesort will be less
efficient with different data sets. But when the size of data gets large,
mergesort will be the quicker one, especially when data is stored on
external drives or devices. This is where mergesort is truly meant to
excel.
So if somebody asked me which one I would recommend, I would
ask them to be more specific about what they are trying to sort. In
general, I would go with quicksort. While this answer may not be so
original, I do believe that quicksort has earned its fame due to its

elegant nature and efficiency. However, if the data is big and/or beyond
the scope of main memory, I would bet on mergesort to do the job
best.

You might also like