Bubble Sort is the most simple form of sorting algorithm that works by repeatedly stepping through the list of items (array) and swapping the adjacent elements if they are in incorrect order. This algorithm has no such real life uses due to it’s poor performance and is used primarily as an educational tool.

Worst and Average Case Time Complexity: O(n2)
Best Case Time Complexity: O(n)

Bubble Sort - Pseudocode

Bubble Sort – Pseudocode

The following C program read an integer array and prints it on the screen. It then sorts the array using bubble sort and print it again.

Output of the Bubble Sort Algorithm