For this Question: You have to write 4 classes as BubbleSort, InsertionSort, MergeSort and SelectionSort, and each of should implement following interface:
<code>
	interface ISort{
    		public int[] sort(int[] arr);
	}
</code>
Each class should be defined as:
 Implement sort in each class with respective method, after sorting return sorted array.You don't have to take any input, you have to write classes mentioned in question which implements ISort.Output will be printed by tester, "Correct" if your code is perfectly fine otherwise "Wrong".Sample Test:
BubbleSort bubbleSort = new BubbleSort();
        arr = bubbleSort.sort(arr);
        if(arr.isSorted()) System.out.println("Correct");
        else System.out.println("Wrong");
Sample Output:
Correct, I have written this Solution Code: class BubbleSort implements ISort{
    public int[] sort(int[] arr){
        int n = arr.length;
        int temp = 0;
        for(int i=0; i < n; i++){
            for(int j=1; j < (n-i); j++){
                if(arr[j-1] > arr[j]){
                    temp = arr[j-1];
                    arr[j-1] = arr[j];
                    arr[j] = temp;
                }

            }
        }
        return arr;
    }
}
class InsertionSort implements ISort{
    public int[] sort(int[] arr){
        int n = arr.length;
        for (int i = 1; i < n; ++i) {
            int key = arr[i];
            int j = i - 1;
            /* Move elements of arr[0..i-1], that are
               greater than key, to one position ahead
               of their current position */
            while (j >= 0 && arr[j] > key) {
                arr[j + 1] = arr[j];
                j = j - 1;
            }
            arr[j + 1] = key;
        }
        return  arr;
    }
}
class MergeSort implements ISort{
    void merge(int arr[], int l, int m, int r) {
        int n1 = m - l + 1;
        int n2 = r - m;
        int L[] = new int [n1];
        int R[] = new int [n2];
        for (int i=0; i<n1; ++i)
            L[i] = arr[l + i];
        for (int j=0; j<n2; ++j)
            R[j] = arr[m + 1+ j];
        int i = 0, j = 0;
        int k = l;
        while (i < n1 && j < n2) {
            if (L[i] <= R[j]) {
                arr[k] = L[i];
                i++;
            }
            else {
                arr[k] = R[j];
                j++;
            }
            k++;
        }
        while (i < n1) {
            arr[k] = L[i];
            i++;
            k++;
        }
        while (j < n2) {
            arr[k] = R[j];
            j++;
            k++;
        }
    }
    void sort(int arr[], int l, int r)
    {
        if (l < r) {
            int m = (l+r)/2;
            sort(arr, l, m);
            sort(arr , m+1, r);
            merge(arr, l, m, r);
        }
    }
    public int[] sort(int[] arr){
        int n=arr.length;
        sort(arr,0,n-1);
        return arr;
    }
}
class SelectionSort implements ISort{
    public int[] sort(int[] arr){
        for (int i = 0; i < arr.length - 1; i++) {
            int index = i;
            for (int j = i + 1; j < arr.length; j++){
                if (arr[j] < arr[index]){
                    index = j;//searching for lowest index
                }
            }
            int smallerNumber = arr[index];
            arr[index] = arr[i];
            arr[i] = smallerNumber;
        }
        return arr;
    }
}, In this Programming Language: Java, Now tell me if this Code is compilable or not?