Working of Bubble Sort

So, we suppose we are trying to sort the elements of an Array in Ascending Order.

  1. In this, we start with the first element.
  2. Compare the element with the next element of the array.
  3. If the current element is greater than the next element, then we swap both the elements.
  4. If not, we move on to the next element of the array and check if this element is greater than the next one.
  5. So, We repeat Steps 2-4 until we get a sorted array in Ascending Order as in this case.
Discussion
Good explanation

1

Great one, thank you for sharing!

8

2