class Solution
{
public:
//Function to sort the array using bubble sort algorithm.
void bubbleSort(int arr[], int n)
{
int flag=0;
for(int k=1;k<=n-1;k++){
for(int j=0;j<=n-k-1;j++){
if(arr[j]>arr[j+1]){
swap(&arr[j],&arr[j+1]);
flag=1;
}
}
if(flag==0)
break;
}
}
void swap(int *xp,int *yp){
int temp=*xp;
*xp=*yp;
*yp=temp;
}
};