SSVISUAL.COM

Bubble Sort

It's like arranging numbers in a list by repeatedly swapping neighboring numbers until the largest one "bubbles up" to the end, and you repeat until the whole list is sorted.

Pseudocode

function bubble_sort(list):
  FOR i = 0 to list.length - 1 DO
    FOR j = 0 to list.length - i - 1 DO
      k = j + 1
IF list[j] > list[k] THEN swap(list[j], list[k]) END IF END FOR END FOR

Terminal

Value 1:

Value 2: