Bubble Sort is an elementary sorting algorithm taught in many
introductory computer science course at schools and universities.

The basic idea of Bubble Sort is swapping neighbouring elements
so that they will then be in ascending order.

A verbal description of Bubble Sort is as follows:

Set n to the length of the input array
Set swapPerformed = 1
for i from n-1 to 1:
  Set swapPerformed = 0
  for j from 2 to i:
    if elements (j-1), j are not in order:
      swap elements at positions j-1, j
      Set swapPerformed = 1
  if swapPerformed is 0, break the outer loop