/* Bubble Sort */

## Description :

Bubble sort is a comparison based sorting algorithm wherein comparing adjacent elements is a primitive operation. In each pass, it compares the adjacent elements in the array and exchanges those that are not in order. Basically, each pass through the array places the next largest value in its proper place, hence the number of comparisons reduces by one at each pass. In other words, each item “bubbles”up to the location where it is supposed to be in the sorted sequence. This invariant is maintained by the algorithm in each pass and hence, bubble sort correctly outputs the sorted sequence. For an n-element array, the below pseudocode requires n − i comparisons for the i th iteration (Pass).

## Program :

## Output :

`Written with ♥ from Mangesh.