Basic concepts of sorting algorithms

Source: Internet
Author: User

1. Basic concepts of sorting

Assume that the sorting object is a collection composed of several records. Each record contains several fields. Select one or more fieldsSort code. For the moment, we assume that the type of the sort code is integer.

Positive Sequence: the sequence to be sorted exactly meets the sorting requirements.

"Reverse Order" sequence: the sequence to be sorted is reversed to meet the sorting requirements.

Sorting stability: records with the same sorting codes remain unchanged after sorting. This sorting method is called "stable". Otherwise, it is unstable.

2. Category

Memory involved in sorting is different

1) Internal sorting refers to the sorting of all the data elements to be sorted in the memory.

2) External sorting is a sorting method that imports data elements into the memory in batches, sorts them, and then exports them to the disk and tape storage media in batches.

Sort by sorting method

1) insert sorting: Direct insertion, binary insertion, table insertion, shell sorting

2) Select sorting: Direct selection and heap sorting

3) Exchange sorting: Bubble sorting and quick sorting

4) allocation sorting: Base sorting

5) Merge Sorting: two-way Merge Sorting

3. SortingAlgorithmRating

1) time complexity: analyze the comparison times of record keywords and the moving times of records (important evaluation criteria)
2) space complexity: Memory auxiliary space used in the algorithm
3) sorting Stability
4) complexity of the algorithm itself

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.