1. The time complexity of an algorithm refers to the corresponding relationship between the running time of the algorithm and the size of the problem. An algorithm is composed of the control structure and the original operation, and its execution time depends on the combined effect. In order to facilitate the comparison of different algorithms of the same problem, the frequency (frequency) of the basic operation repetition in the algorithm is usually used as the time complexity of the algorithm. The basic operation in the algorithm generally refers to the statement in the deepest loop of the algorithm, therefore, the frequency of the basic operation statement in the algorithm is a function f (n) of the problem scale N, which is recorded as T (N) =o (f (n)).
If an algorithm does not have a loop statement, the execution frequency of the basic operation in the algorithm is independent of the problem scale N, which is called the O (1), also known as the constant order. If the algorithm has only one cycle, then the execution frequency of the basic operation of the algorithm is linearly increasing with the problem size n, which is called O (n), also known as the linear order. Commonly used are square order O (n^2), Cubic O (n^3), logarithmic order, etc.
Data structure and algorithm 2016-06-02