Algorithm complexity is divided into time complexity T (N) and space complexity F (n)
Time Complexity: the time required to execute an algorithm program depends on the speed of hardware, the programming language level, compiler optimization, data size, and execution frequency, the first three indicators have great uncertainty. Therefore, the time complexity of the algorithm is the function of data scale N as long as the latter two indicators are used. T (n) = O (f (n), where O indicates the same order, that is, when n approaches infinity, T (N) and F (N) the ratio is a constant not 0, that is, the progressive time complexity. The ascending order of time complexity is: constant order O (1), logarithm order o (log2n), linear order O (N), linear logarithm order o (nlog2n), square order O (N ^ 2), cubic order O (N ^ 3), k power order O (N ^ K), exponential order o (2 ^ N ).
Space complexity: Memory occupied by algorithms, input data, and running time. Compression storage technology is usually used.