Time complexity the code of experience without loops is called Chang (O (1)), and the constant order cannot be a loop most of the single-cycle to linear-order O (n) Double-loop to the square-order O (N2) Triple-loop for the cubic-order O (N3) binary lookup method is the logarithmic-order algorithm if a one-cycle is not , the algorithm must be a logarithmic order, a summary of the time complexity, the size of the problem (how many problems), the frequency of the sentence (the sum of the statements required to solve the problem) time complexity (the rate of growth of the algorithm execution time) as determined 3 times instead of n solve the time complexity is a constant order, If the output of a helloworld, as long as 1 execution of the statement can solve the problem if the execution of the statement execution, but the increase to n can solve the problem is a linear order problem, such as a single heavy loop only need to loop n times to ensure that the problem, that is, the linear order if the execution statement grows more than n times, very N2 The problem of square order, the common double loop is definitely the least N*N time statement to solve the problem is the square order problem if the execution statement grows more than n*n times that is n^ (3) N*n*n execution statement to solve the problem, this is the cubic order problem common triple loop least n*n* N-Times execution is a cubic order problem.
Experience of time complexity