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:

If the input array is null, return.
Declare variables i, j and set i to the last array position.
Declare a variable isSorted and set it to false
While i >= 0 and isSorted is false:
  Set isSorted = true
  Set j = 0 and while j <= i - 1:
    If a[j] > a[j + 1]:
      Swap the elements
      Setze isSorted = false
    Increment j
  Decrement i