The execution time of the algorithm is a function of the time complexity. The time complexity of the algorithm is recorded as T (n)=O (f (n)). With the increase of module n, the growth rate of algorithm execution time is proportional to the growth rate of f (n), so the smaller f (n) is, the lower the time complexity of the algorithm is, and the higher the efficiency of the algorithm is.
When calculating the time complexity, first find out the basic operation of the algorithm, then determine its execution times according to the corresponding statements, and then find out the same magnitude of T (n) (its same magnitude is as follows: 1, Log2n, n, nLog2n, n square, n cubic, 2 n-power, n!). After finding out, F (n)=this order of magnitude. If the limit of T (n)/f (n) can get a constant c, then the time complexity T (n)=O (f (n)).