Bubble sort of a array

The bubble sort is generally considered to be the simplest sorting algorithm.

The bubble sort works by passing sequentially over a list, comparing each value to the one immediately after it. If the first value is greater than the second, their positions are switched. Over a number of passes, at most equal to the number of elements in the list, all of the values drift into their correct positions. Because each pass finds the maximum item and puts it at the end, the portion of the list to be sorted can be reduced at each pass.


Enjoy it :)


No comments:

Post a Comment