Bubble Sort Algorithm in Java
Bubble sort is very popular and one of the easiest sorting algorithms available. It passes over the array several times (actually less than the number of elements in the array). At each pass, it compares two consecutive elements and swaps them if necessary. It has worst case running time of O(n^2) and best case running time of O(n).