Bubble sort algorithm implementation.