ArticleDirectory
- 2.1 Analysis Framework
- 2.2 progressive symbols and basic efficiency types
- 2.3 Mathematical Analysis of Non-Recursive Algorithms
- 2.4 Mathematical Analysis of Recursive Algorithms
2.1 Analysis Framework 2.1.1 input scale measurement
- In most cases, n is input.
- Matrix, dimension
- ValueAlgorithm, Number of BITs
2.1.2 measurement unit of running time
- Find out the most important operation in the algorithm, that isBasic operations
- Calculate the number of times they run
2.1.3 increase times
Logn n nlogn N2 N3 2n n!
2.1.4 optimal, worst, and average efficiency of Algorithms
- Optimal efficiency
- Worst Efficiency
- Average Efficiency
- Amortization Efficiency
2.2 Introduction to progressive symbols and basic efficiency types 2.2.1
Primary, Ω, primary
Bytes(G (N) is a set of functions that increase the number of times less than or equal to G (n ).
Ω(G (N) is a set of functions that increase more than or equal to G (n ).
Bytes(G (N) is a set of functions that increase the number of times to G (n ).
2.2.2 symbol
Bytes 2.2.5 useful features of progressive symbols
2.2.6 increase by limit
The first two cases:
The last two cases:
Case 2:
2.2.7 basic efficiency types 2.3 Mathematical Analysis of Non-Recursive Algorithms
A general solution for analyzing the efficiency of non-recursive algorithms:
- Determines which (some) parameter is used as the input scale measurement.
- Find out the basic operation of the algorithm (as a rule, it is always located in the innermost loop of the algorithm)
- Check whether the number of basic operations depends on the input size. For example, if it depends on other features, such as the input sequence, the worst efficiency, average efficiency, and optimal efficiency need to be studied separately.
- Creates a sum expression for the number of times an algorithm performs basic operations.
- Use the standard formulas and rules of the sum operation to establish a closed formula for the number of operations, or at least determine the number of increases.
Two basic rules for sum calculation:
Two common summation formulas:
2.4 Mathematical Analysis of Recursive Algorithms
UseRecurrenceNumber of basic operations
- Determines which parameters are used as the input scale measurement.
- Basic algorithm operations
- Check whether the number of basic operations varies with input of the same scale. If they are different, the worst efficiency, average efficiency, and optimal efficiency must be studied separately.
- Establishes a recursive relationship and corresponding initial conditions for the number of executions of basic algorithm operations.
- Solve this recursive formula, or at least determine the number of times the solution increases.