I. Large O notation
Large o notation is not an algorithm. It is used to indicate how quickly an algorithm solves a problem. In general, we describe how quickly a thing is done in terms of time, for example, how many minutes I have completed a computational problem. But the algorithm is difficult to use accurate time to describe, so we use the algorithm to solve the problem of a total number of steps to represent the speed of the algorithm.
Using the first two search methods for example, simple find we want to use each element of the list to compare one by one, if there are n elements, then the simple lookup requires up to n steps to find the data (data at the end of the list). While two-point lookup uses only the median to compare, when looking for an array with n elements, it is necessary to log2n the number of times.
The speed of the two algorithms is represented by the large O notation: O (n), O (log2n).
Note: 1. Large o notation reflects the worst case scenario of the algorithm; 2. The large O notation indicates that the algorithm solves the problem by changing the number of operands as the data increases.
Other common large O-notation:
O (N)--Simple search
O (LOG2N)--Two points find
O (n!)--Travel business issues
Second, the problem of traveling business
If a traveler wants to route 5 cities, he plans the shortest route connecting the 5 cities, then he will calculate (5x4x3x2x1=) 120 times to find the shortest route. Similarly, if you want to route n cities, you have to go through n! calculation to find the shortest route. This is the problem of traveling business.
2. Large o representation of data structures and algorithms