. NET Study notes----2015-07-09 (Basic review and Exercise 06)

Source: Internet
Author: User

Bubble Sort,

I did it two times.

            //1, 3, 4, 2, 6, 8, 7, 9, 0, 5//10 elements, starting with the first one, and then comparing each element in the array,//if nums[0]>nums[1] then two elements exchange position, and so on until Nums[9]//which is to compare 9 times .//the remaining 1 elements must be the smallest (ascending example)             for(inti =0; I < Nums. Length-1; i++)            {                //When the first number is compared, the number does not have to be compared, so j-1-i                 for(intj =0; J < Nums. Length-1I J + +)                {                    inttemp = nums[0]; nums[0] = nums[1]; nums[1] =temp; }                            }             for(inti =0; I < Nums. Length; i++) {Console.WriteLine (Nums[i]=i); }

. NET Study notes----2015-07-09 (Basic review and Exercise 06)

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.