package Sorts; import java.util.Arrays; import java.util.*; /*This code implements the mergeSort algorithm without extra space For understanding about mergesort visit :https://www.geeksforgeeks.org/merge-sort/ */ public class MergeSortNoExtraSpace { public static void call_merge_sort(int a[],int n) { int maxele = Arrays.stream(a).max().getAsInt() + 1; merge_sort(a,0,n-1,maxele); } public static void merge_sort(int a[],int start , int end,int maxele){ //this function divides the array into 2 halves if(start