operations if the list is already sorted, whereas naïve
implementations of bubble sort (like the pseudocode below)
require O(n^2) operations. (This can be
reduced to O(n) if code is added to stop the
outer loop when the inner loop performs no swaps.) [2]. For
example, in [6] we find: ―The bubble sort is worse than
selection sort for a jumbled array—it will require many more
component exchanges—but it’s just as good as insertion sort
for a pretty well-ordered array. More important, it’s usually the
easiest one to write correctly.‖ Owen says that Bubble sort’s
prime virtue is that it is easy to implement, but whether it is
actually easier to implement than insertion or selection sort is
arguable [5]. Authors have tried to bring the Bubble Sort closer
to other sorts by using a new variation.