Bubble Sort Algorithm


Bubble sort is one of the simplest sorting algorithms. In this algorithm adjacent elements are swapped repeatedly until they are in their intended place.

There are not much real world application of this algorithm with large data set as it’s performance is not that good.

The time complexity of this algorithm is O(n2)

Bubble Sort Algorithm

begin bubbleSort ( arr )
  for all array elements
    if(arr[I] > arr[I]
      swap(arr[I], arr[i+1])
    end if
  end for
    return arr
end bubbleSort