Home > Back-end >  Time is how to calculate the frequency and time complexity
Time is how to calculate the frequency and time complexity

Time:10-26

Thank you!

CodePudding user response:

Oneself is derived according to the code, a total of how many times about the calculation of n
If it is an a + b, a and b are coefficients, then complexity is O (n)
If it is, the an ^ 2 + bn + c, a, b, c is a factor, the complexity is O (n ^ 2)
So on
In case of index such as 2 ^ n, it is higher than polynomial complexity is O (2 ^ n)
In simple terms, after calculation formula, ignore all coefficient, only look at the biggest impact of the project
  • Related