How to perform complex analysis?

Time complexity analysis:

1, a large degree of complexity O notation: T (n) = O (f (n)), of the formula O, the execution time code T (n) and f (n) is proportional to the expression

  • Only concerned with the number of cycles to execute up to a piece of code
  • The total complexity is equal to the magnitude of the largest part of the code complexity
  • Complexity of nested tags is equal to the product of the nested inner and outer code complexity

2, the worst case time complexity: code execution in the best case complexity
3, the best-case time complexity: code execution in the worst case complexity of
4, the average time complexity: all code the number of times executed when the weighted average of
5, amortized time complexity: complexity of the very few high-level and timing relationship having occurred, these can be several shared equally high level of complexity to complexity level low, generally results amortized it is equal to the low level of complexity

 

Space complexity analysis:

  • Similar to the time complexity analysis, the relationship between the growth of storage space concerns algorithms and data scale

 

Common Complexity:

  • Common not much complexity, from low to high order: O (1), O (logn), O (n), O (nlogn), O (n2)


Description link

 


 

 

Guess you like

Origin www.cnblogs.com/ConstXiong/p/12151833.html
Recommended