2024-07-08
한어Русский языкEnglishFrançaisIndonesianSanskrit日本語DeutschPortuguêsΕλληνικάespañolItalianoSuomalainenLatina
Table of contents
Quick sort O(n log n) [divide and conquer] Unstable
What is a stable sorting algorithm: the order of data remains unchanged
Selection sort O(n2) Merge sort O(n log n) Insertion sort O(n2) Heap sort O(n log n) Shell sort O(n log2 n) Library sort O(n log n) Bubble sort O(n2) Radix sort O(n · k) Quick sort O(n log n) Bucket sort O(nk) Counting sort O(nk) Pigeonhole sort O(n D):
► First find the minimum value and swap it with the element in the first position
► Repeat the above process for the remaining data until the sorting is completed.
Merge: If there are two separately ordered arrays, you can use double pointers to merge them into a completely ordered array
You can recursively write
You can also start from 0
Merge 1-1