Solution to the bubble sort problem.