The “bubble” sort is called so because the list elements with greater value than their surrounding elements “bubble” towards the end of the list. For example, after first pass, the largest element is bubbled towards the right most position.
How bubble sort is named?
The name bubble sort comes from the fact that smaller or larger elements "bubble" to the top of a dataset. ... This algorithm is alternatively called the sinking sort for the opposite reason; some of the elements are sinking to the bottom of the dataset. In our example, the 1 and the 2 are sinking elements.
What is meant by bubble sort?
Bubble sort, sometimes referred to as sinking sort, is a simple sorting algorithm that repeatedly steps through the list, compares adjacent elements and swaps them if they are in the wrong order. The pass through the list is repeated until the list is sorted.