diff --git a/MergeSort.java b/MergeSort.java new file mode 100644 index 0000000..f0850b3 --- /dev/null +++ b/MergeSort.java @@ -0,0 +1,51 @@ +/* + * To change this license header, choose License Headers in Project Properties. + * To change this template file, choose Tools | Templates + * and open the template in the editor. + */ +package sort; + +/** + * + * @author User + */ +public class MergeSort { + + private static int[] aux; + public static void merge(int[] a,int low, int mid,int high){ + int i=low; + int j=mid+1; + + for(int k=low;k<=high;k++){ + aux[k]=a[k]; + } + for(int k=low;k<=high;k++){ + if(i>mid){ + a[k]=aux[j++]; + + } + else if(j>high){ + a[k]=aux[i++]; + } + else if(aux[j]