Modified NaiveBubbleSort.