#19.5.17

Here Insert Picture DescriptionExplanation
Time complexity of O (g (n))
time complexity: the presence of the function g is assumed that the algorithm A is designed to treat the problem exemplary n used time is T (n) = O (g (n)), called O ( g (n)) is the asymptotic time complexity of the algorithm a, the time complexity for short, referred to as T (n).

For example:
T (n-) = n- n- n- 10
G (n-) = n-
n- n-
so T (n-) = K
G (n-) + C

Big O notation: just take the highest order.

1. The worst time complexity of
the number of basic arithmetic operations required to complete the work up to that complexity is the worst time.

2. The best time complexity of
the algorithm to complete the work requires a minimum number of basic operations, that is the best time complexity.

2. The average time complexity of
how much the basic arithmetic operations to complete work on average, that the average time complexity.


Time complexity of computing a few basic rules

The basic operation, that is, only the constant term, that its time complexity is (1) O
sequential structure, the time complexity is calculated by adding
the cyclic structure, the time complexity is calculated by multiplying
a branched structure, the time complexity of the maximum value
determination algorithm a when the efficiency, often only need to focus on operating the highest number of times a term, other minor items and the constant term can be neglected
in the absence of special note, we analyzed the time of the algorithm complexity refer to the complexity of the worst time

Guess you like

Origin blog.csdn.net/weixin_44719417/article/details/90291499