Search code examples
algorithmlanguage-agnosticsortingbubble-sort

What is a bubble sort good for?


Do bubble sorts have any real world use? Every time I see one mentioned, it's always either:

  1. A sorting algorithm to learn with.
  2. An example of a sorting algorithm not to use.

Solution

  • It depends on the way your data is distributed - if you can make some assumptions.

    One of the best links I've found to understand when to use a bubble sort - or some other sort, is this - an animated view on sorting algorithms:

    http://www.sorting-algorithms.com/