Sorting refers to the process of arranging chaotic data elements in keyword order through a certain method; its purpose is to adjust a set of "unordered" record sequences into an "ordered" record sequence. Sorting is divided into internal sorting and external sorting; if the entire sorting process can be completed without accessing external memory, it is called internal sorting; otherwise, it is called external sorting.
Sorting is an operation often performed in the computer. Its purpose is to adjust a set of "out-of-order" record sequences into "ordered" ones. " record sequence. It is divided into internal sorting and external sorting. If the entire sorting process can be completed without accessing external memory, this type of sorting problem is called internal sorting. On the contrary, if the number of records participating in the sorting is very large and the sorting process of the entire sequence cannot be completed in memory, this kind of sorting problem is called external sorting. The process of internal sorting is a process of gradually expanding the length of the ordered sequence of records.
Concept:
The process of arranging messy data elements in keyword order through a certain method is called sorting.
Common sorting algorithms:
Quick sort, Hill sort, heap sort, direct selection sort are not stable sorting algorithms, while radix sort, bubble sort Sorting, direct insertion sort, half insertion sort, and merge sort are stable sorting algorithms.
Category:
Stable sorting: Assume that in the file to be sorted, there are two or more records with the same key After sorting by a certain sorting method, if the relative order of the elements with the same keyword remains unchanged, this sorting method is stable. Among them, bubble, insertion, radix, and merge belong to stable sorting, while selection, fast, and Hill belong to unstable sorting.
In-place sorting: If the auxiliary space required by the sorting algorithm does not depend on the size of the problem n, that is, the auxiliary space is O(1), it is called in-place sorting.
For more related knowledge, please visit PHP Chinese website! !
The above is the detailed content of What does sorting mean?. For more information, please follow other related articles on the PHP Chinese website!