Merge sort does not understand, first do the problem, then look at the back, and now there is no solution is to seek to merge the order of the middle sequence of the next sequence
PackageCom.company;Importjava.util.Arrays;ImportJava.util.Scanner; Public classMain { Public Static voidMain (string[] args) {Scanner sc=NewScanner (system.in); intnum=Sc.nextint (); int[] s=New int[num]; int[] s0=New int[num]; int[] s1=New int[num]; for(inti=0;i<num;i++) {S[i]=sc.nextint ();//3 1 2 8 7 5 9 4 6 0s0[i]=S[i]; } for(inti=0;i<num;i++) {S1[i]=sc.nextint ();//1 2 3 7 8 5 9 4 6 0 } //the next step is to get a S1 judgment . intK=0; intA=0; for(inti=num-1;i>=0;i--){ if(s1[i]==S[i]) {k=i; }Else{k=i+1; Break; } } Booleanb=false; for(inti=k-1;i>=1;i--){ if(s1[i]-s1[i-1]>=0) {b=true; }Else{b=false; A=1; System.out.println ("Merge Sort"); Break; } if(b&&i==1) {a=0; System.out.println ("Insertion Sort"); Break; } } //to find the value of the next iteration if(a==0) {//Insert SortArrays.sort (s1,0,k+1); for(inti=0;i<num;i++){ if(i<num-1) {System.out.print (S1[i]+" "); }Else{System.out.print (s1[i]); } } } if(a==1){ //working with the S1 for(inti=0;i<num;i++){ } } }}
1035 (not completed)