Bubble sort compares the value of current node with the immediate next node and swaps according
to the requirement and goes till the last element.
Compare and swapping two elements like small soap bubbles and hence the name given as bubble sort.
Bubble sort Big(o)
Bubble sort of N elements can take (N - 1) steps and (N -1) iterations in each steps. Thus resultant is (N - 1)*(N - 1).
This sorting algorithm is not however the best in performance when count of the elements are large.
Time complexities of bubble sort is Big(o) = N^2 [Square of N]. This sorting is well suited for small number of elements and it is easy the implement in C or any other programming languages.
Bubble sort source code
Here is a C source code of Bubble sorting with 5 integer elements. This code sorts the elements in ascending order.