File:Bubblesort-edited-color.svg · Wikimedia Commons · See Wikimedia Commons
Bubble sort is a straightforward method for arranging items in order by repeatedly comparing neighboring items and swapping them if they're in the wrong sequence. It's a useful algorithm for learning how sorting works, though faster methods exist for large collections of data.
AI-generated from the Wikipedia summary — may contain errors.
In the Vinony graph
Within Vinony's link graph, bubble sort is referenced by 88 other articles, and connects out to cocktail shaker sort, Barack Obama and Google.
It sits within the topics Comparison sorts and Stable sorts.
Its subject is documented across 51 Wikipedia language editions.
Wikidata facts
- Instance of
- comparison sort
- Named after
- bubble
- Image
- Bubblesort-edited-color.svg
Show 3 more facts
- Commons category
- Bubble sort
- Stack Exchange tag
- stackoverflow.com/tags/bubble-sort
Sources (1)
via Wikidata · CC0
~12 min read
Encyclopedic overview
Bubble sort, sometimes referred to as sinking sort, is a simple sorting algorithm that repeatedly steps through the input list element by element, comparing the current element with the one after it, swapping their values if needed. These passes through the list are repeated until no swaps have to be performed during a pass, meaning that the list has become fully sorted. The algorithm, which is a comparison sort, is named for the way the larger elements "bubble" up to the top of the list.
It performs poorly in real-world use and is used primarily as an educational tool. More efficient algorithms such as quicksort, timsort, or merge sort are used by the sorting libraries built into popular programming languages such as Python and Java.
Excerpted from Wikipedia’s “bubble sort” article, available under the CC BY-SA 4.0 licence.