1035 (not completed)

Source: Internet
Author: User

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)

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.