1. Bubble sort
Compare and swap from the first element to the right element 22, until the right side becomes an ordered part.
2. Select sort
The ordered part is on the left, finding the smallest element in the remaining element and exchanging it with the first element in the remaining element.
3. Insert Sort
The ordered part is on the left, and the first element in the remaining element is exchanged continuously to the left until the element is in the proper position in the orderly part.
4. Hill sort
Takes an interval value that is a set of elements with a distance of interval values and divides the entire array into groups. Inserts are sorted within each group. The interval value is reduced and repeated until the interval value is 1, which means that all elements are in the same group.
5. Merge sort
Divide and conquer. Divides the array into two halves, sorts the two halves by a recursive call, and then merges the two halves in the order.
6. Quick Sort
Divide and conquer. Optionally, select the first element as the slice element. The left and right hands are scanned in the middle, and the side is scanned to an element that is greater than or equal to the Shard element, and to an element that is less than or equal to the split element When the left and right hands overlap, the coincident position element is exchanged with the Shard element, so that the Shard element is in the middle. Recursive calls, sorting the left and right parts separately.
7. Heap Sequencing
Binary heap: A full binary tree with a parent node value greater than or equal to two byte point value.
When represented by an array that is empty for the first element, the location of the parent node of the K node is K/2, and the two-byte point position is 2k and 2k+1, respectively.
Insert element: Adds a new element to the end and floats the element to the appropriate position.
Delete the largest element: Delete the top element, put the last element to the top, and sink the element to the appropriate position.
The ordered heap is constructed from a right-to-left sinking from the N/2 position. Take the top element of the heap as the sorted part, put the end element to the top of the heap and sink to form a new ordered heap.
7 kinds of common sorting algorithms