Skip to main content
10 events
when toggle format what by license comment
Oct 27, 2013 at 3:20 history made wiki Post Made Community Wiki by Michael Shaw
May 1, 2012 at 22:07 comment added Qwertie BTW, insertion sort is just as simple as bubble sort, is never slower and often faster, so I don't know why anyone would talk about bubble sort at all. Quick sort is a little more complicated and difficult to get right (my high school class was assigned to write a quick sort... and not one of us students got it right on our first try), but now that all standard libraries have one, there's little excuse not to use it. Btw, don't write a quick sort yourself, it's too easy to write a quicksort that runs in O(N^2) time on sorted data or data with many duplicate items.
May 29, 2011 at 8:37 history migrated from stackoverflow.com (revisions)
Dec 19, 2008 at 21:25 comment added David Thornley My idea of a default sort is whatever the library gives me (qsort(), .sort(), (sort ...), whatever).
Dec 19, 2008 at 20:54 comment added BCS Secure code (military types n'all) and Real time stuff never uses quick sort because of it's worst cases O(). They use Heap sort or Merge sort or whatnot.
Oct 17, 2008 at 9:15 comment added Shane MacLaughlin True, but I would have quicksort as my default sort. If I thought bubblesort would improve performance, this would be an optimization, not the other way around. I choose quicksort as my default because it is well understood and generally better.
Oct 17, 2008 at 8:54 comment added m_pGladiator yeah, but that's just an example how to select algorithms for different needs ;)
Oct 17, 2008 at 8:53 comment added workmad3 For really small numbers of items, the recursion required for quicksort can make it slower than a decent bubblesort though... not to mention that a bubblesort is quicker in the worst-case scenario of quicksort (namely quicksorting a sorted list)
Oct 17, 2008 at 8:47 comment added Shane MacLaughlin Don't agree. I'd say never use a bubble sort. Quicksort has become a defacto standard and is well understood, and is as easy to implement as a bubble sort in all scenarios. The lowest common denominator is not that low any more ;)
Oct 17, 2008 at 8:40 history answered m_pGladiator CC BY-SA 2.5