Sorting table sorting, cardinality sorting, and comparison of all sorting algorithms

Source: Internet
Author: User

This study note part of the content from Zhejiang University NetEase Cloud Classroom, thank you! 1, table sortingDefines a pointer array as a table. When sorting, the value of the array position does not change, and the pointer direction is changed.
As shown in the figure, the initial value: F D c A G B h e When comparing f>d, the pointer 0 points to D, and pointer 1 to F. After comparing f>c,d>c, pointer 0 points to C, pointer 1 to D, and Pointer 2 to F. And so on, the final pointer 0 points to the position of a (that is, table[0]=3,a[3] that position)
2. Base OrderBasic ideas: such as decimal digit sorting, first by single digit size row, and then by 10-digit size row, in turn. Examples are as follows:
The cardinality sort can be used to sort multiple keywords. such as poker: color and digital size two keywords. 3. Comparison of sorting algorithmsNote: Stability refers to if the two number is equal, after the completion of the sequence, its relative position has not changed, the word is stable. The d of the hill sort depends on the selection of the increment sequence, up to a maximum of 2.When the sequence is basically ordered,Quick SortThe algorithm is the least efficient.
Insert Sort, it is possible that all elements are not in their place until the last trip begins.

Copyright NOTICE: This article for Bo Master original article, without Bo Master permission not reproduced.

Sorting table sorting, cardinality sorting, and comparison of all sorting algorithms

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.