Why is bubble sort called ‘Bubble Sort’?

I have read many contents on bubble sort, but found one same reason for this name. The reason they said is:

Because its easy to swap soap bubble/watter bubble, and that is what we do in bubble sort, we swap those elements which satisfy our condition.

Today I got to know a good, a real-like reason while reading a blog. The reason is :

Air bubbles that are more buoyant than surrounding water rise to the top. Similarly, list elements with greater value than their surrounding elements “bubble” to the end of the list.

Thanks for reading…

Source link