Implementation of the Bubble sort algorithm (works by repeatedly swapping the adjacent elements if they are in the wrong order).