Bubble sort and select sort

Source: Internet
Author: User

Http://www.runoob.com/w3cnote/sort-algorithm-summary.html Summary

Reading "Introduction to Computer Science" third edition

The difference in Baidu know to find:

The difference is that the bubbling algorithm, each time a comparison is found in the back of the smaller elements, the exchange of two adjacent elements. and the choice of sorting algorithm improvement is: first not in a hurry to change position, first from a[1] start one by one, to see which number is the smallest to write down the position of the number of P, and so a lie scan completed, and then A[p] and a[1] swapped, then a[1] to a[10] the smallest data in the top position.

So, choosing to sort the array once per scan, requires only a real exchange, and bubbling may take many times. The number of comparisons is the same.

Bubble sort and select sort

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.