We have some best sorting methods like quick sort, merge sort etc., then why we need other sorting methods which perform poor?


marked as duplicate by Raphael Jan 12 '18 at 11:33

This question has been asked before and already has an answer. If those answers do not fully address your question, please ask a new question.

  • $\begingroup$ Are you asking why bozosort is described in the literature? $\endgroup$ – Peter Taylor Jan 12 '18 at 11:18

Some kind of sorting algorithms may end up being visually more pleasing, giving nicer intermediate steps allowing for visual inspection of data where a human can recognize where in the process one is and analyze what goes wrong and sanitze the data accordingly.

I know I have used sometimes some costly sorting algorithm because it came in handy during game programming, giving just the right effect(revealing something on monitor, sorting inventory, etc...) on screen without it looking computer generated.

Like T.S. Elliot said:

The journey, Not the destination matters...

To see what I mean(source of images https://imgur.com/gallery/voutF):

! bubble sort

! Cocktail shaker sort

! insertion sort

! shell sort

! Comb sort

! merge sort depth first

! heap sort shift up

  • $\begingroup$ Those are so cool. I would like to see examples using parallel threads, e.g. for merge-sort. (I wrote a parallel version.) $\endgroup$ – Jive Dadson Jan 12 '18 at 11:26
  • $\begingroup$ If you look at the linked imgur post you can see what I believe are combos of different sorting algorithems done together. $\endgroup$ – Tschallacka Jan 12 '18 at 12:51

We probably don't need all the O(n^2) ones. But some of them can be useful during the end-game. For example, a popular C++ standard library employs merge-sort to implement std::stable_sort, but switches to insertion-sort when a sub-array has length 32 or less.

But the real reason that we have "so many" sorting algorithms is that throughout the years, no beginner has been able to resist the urge to invent their own sorting algorithm.