Applying the bubble sort