//cpp funtion for sorting using bubble sort
//
    void swap(int *xp, int *yp)
    {
        int temp = *xp;
        *xp = *yp;
        *yp = temp;
    }
    void bubbleSort(int arr[], int n)
    {
        // Your code here  
        for(int i = 0; i<n-1; i++)
    {
        for(int j = 0; j<n-i-1; j++)
        {
            if(arr[j]>arr[j+1])
            {
                swap(&arr[j], &arr[j+1]);
            }
        }
    }
//
//java funtion 

public static void bubbleSort(int arr[], int n)
    {
        //code here
        int i, j;
	    //Traversing over the array.
        for (i = 0; i < n-1; i++)  
        {
            //Last i elements are already in place so we do not include them.
            for (j = 0; j < n-i-1; j++)
            
            if(arr[j] > arr[j+1])
                {
                    //Swapping, if the element at current index is greater 
                    // than the next element. 
                    int temp = arr[j];
                    arr[j] = arr[j+1];
                    arr[j+1] = temp;
                }
        }
    }