Algorithm efficiency measurement methods: Ex-post statistical methods, ex ante analysis and estimation methods.
The time complexity of the algorithm: in the analysis of the algorithm, the total execution times of the statement T (N) is about the problem scale n function, and then analyze T (n) with N and determine the order of magnitude T (N). The time complexity of the algorithm is recorded as: T (n) =o (f (n)). It indicates that the growth rate of the algorithm execution time is the same as that of F (n) with the increase of the problem scale N, which is called the asymptotic time complexity of the algorithm, referred to as time complexity. With the increase of the input scale n, the slowest growth of T (n) algorithm is the optimal algorithm.
The method of large O-order is deduced: 1. Substituting constant 1 for all additive constants in the running time; 2. In the modified run-times function, only the highest order is preserved; if the highest order exists and is not 1, the constant that multiplies the item is removed. (Consider series)
Linear order: generally contains non nested loops involving linear order, linear order is with the expansion of the problem scale n, the corresponding number of calculation is linearly increasing.
Square Order: 2 loops are nested together.
Log Order:
Analysis of time complexity of function call
The spatial complexity of the algorithm: the required storage space for the algorithm, S (n) =o (F (n)).