void exch(int arr[], int i, int j)
{
int temp = arr[i];
arr[i] = arr[j];
arr[j] = temp;
}
void bubble_sort(int arr[], int n)
{
for(int i = n-1; i > 0; i--)
{
// Bubble larger elements to end of the array.
for(int j = 0; j < i; j++)
{
if(arr[j] > arr[i]) exch(arr, i, j);
}
}
}