[Algorithm-sorting 5] Select sorting

Source: Internet
Author: User

Algorithm-sort by selection
Excellent sorting algorithms include fast sorting and Hill sorting.Sorting is a preferred and most likely method. Because the selection of sorting is simple and clear, and the effect is obvious, when processing small-scale sorting, selecting sorting is a good choice.
1. Select to sort SelectSort ():Core: The smallest number is selected at the beginning of the constituency. Description:  The smallest number 1 is the 4-switching position at the first position of the current constituency.When the selected area has only the last number, the sorting is complete. The following is the code for fast sorting:
The selection of sorting means that the minimum (of course the maximum) value can be selected each time to the front-end position of the number order. The entire number order is sorted.2. Time Complexity:The entire sorting needs to be compared n-1 times, respectively n-1, N-2... 1. So the time complexity O = (n-1) + (n-2) +... + 1 = O (n2 ).3. space complexity:An auxiliary space, so the space complexity is: O (1 ).
 

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.