Complexity of the algorithm
The complexity of the algorithm is divided into time complexity and space complexity. Its function: Time complexity refers to the computational effort required to execute the algorithm, while space complexity refers to the memory space required to execute the algorithm. (The complexity of the algorithm is reflected in the amount of resources required to run the algorithm, the most important thing in computer resources is time and space (that is, register) resources, so complexity is divided into time and space complexity).
Sorting algorithm:
1. Bubble sort
2. Select sort
Each time a minimum (or maximum) element is selected from the data element to be sorted, it is stored at the beginning of the sequence until all the data elements to be sorted are exhausted. Select Sort is an unstable sort method
3. Quick Sort
Start by selecting one of the data (usually the first number of the array) as the key data, and then putting all the smaller numbers in front of it, all the larger numbers are placed behind it, this process is called a quick sort. It is important to note that fast sorting is not a stable sorting algorithm, that is, the relative position of multiple identical values may change at the end of the algorithm.
4. Insert Sort
Each step inserts a record to be sorted by the size of its key value into the appropriate position in the previously sorted file until all is inserted. The time complexity is O (n^2).
iOS Development Basics notes-algorithms < three >