Sort: It is to organize a group of disordered data according to a certain rule (ascending or descending order).
Sorting code: Usually data elements have multiple attribute fields that can be used to distinguish elements. As a sorting basis, this field is the sorting code. There is an attribute field that can be used to distinguish the elements according to the main sorting code, the sorting result is unique. Sort by the secondary sorting code, the sorting result may not be unique.
If there are two elements R[i] and R[j] in the sequence of elements, theirSorting code K[i]== k[j]And atBefore sorting, the element R[i] is in front of R[j]. If inAfter sorting, the element R[i] is still before R[j], Then call this sortAlgorithm is stable, Otherwise the sorting algorithm is said to be unstable,
Internal sorting: Sorting where all data elements are placed in memory.
External sorting: too many data elements cannot be placed in memory at the same time. According to the requirements of the sorting process, the sorting of data cannot be moved between internal and external memory.


Time complexity of common sorting algorithms Space complexity Space Complexity (Space Complexity) is a measure of the amount of storage space that an algorithm temporarily occupies during operat...
Bubble algorithm: time complexity O(n^2), relatively stable Selection order: time complexity O(n^2), unstable ...To be updated...
Algorithm complexity and stability Corresponding Code...
Ten sequence list Chinese name English name Average time complexity Space complexity stability Select sort Selection n^2 1 Unstable Bubble Sort Bubble n^2 1 stable Insert order Insertion n^2 1 stable ...
There are three main sorting algorithms with O(N) time complexity-bucket sorting, counting sorting and cardinal sorting, the latter two are based on the idea of bucket sorting 1. Bucket sorting &mid...
The time complexity is O(N²), there are three sorting algorithms-bubble sort, selection sort, insertion sort Bubble Sort Basic idea Suppose the array to be sorted is arr, the length is n, the out...
Write in front: Today, referring to the following article, I manually write a few codes of common sorting algorithms. This article is very clear, recommended: Several common sorting algorithms of Java...
Sorting algorithm Summary: The principle, time complexity, usage scenarios, stability. The principle of bubble sort: relatively simple, not described. Stability: Stable Usage scenarios: for small n si...
One, insertion sort 1.1 Direct insertion sort Space complexity:。 time complexity:. In the best case, the elements in the table are already in order. At this time, every time you insert an element, you...
Eight sorting algorithm ideas, time complexity, stability, and java implementation One, merge sort 2. Insertion sort-direct insertion sort Three, insertion sort-Hill sort Fourth, exchange sort-bubble ...