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