Skip to main content

Which Applications are not suitable for quicksort and why ?


Quicksort alone is impractical for external sorting, that is, sorting data (typically, large volumes of data) stored on disk instead of main memory. Quicksort requires all the data to be available at once in memory, which is impossible in this case.

External sorting strategies typically work by loading small chunks of data into main memory.
Then, these chunks are sorted independently .

(Quicksort is a good choice for this, as it outperforms other algorithms in virtually all cases).

Then these sorted chunks are merged together,
and written back to disk.

If we do not merge all the chunks together at once,
these chunks can be merged together to get a larger sorted chunk,
and so on, till the file is completely sorted.
Instead of the usual 2-way merging (two sorted lists are merged together to a single list) which we associate with merge sort, we can extend the idea to k-way merging (for example, with k = 10).