Summary: This section describes the realization and effect of magnification test.
Focus:
1. The realization of magnification test:
· Develop an input generator to produce various possible inputs in real-world situations.
· Run the program, which calculates the ratio of each experiment to the last run time.
· Repeated operations know that the ratio is approaching the limit 2^b.
This experiment is ineffective for algorithms with no limit to the ratio, but it still applies to many programs, and we can draw the following conclusions:
· Their operating time is increasing in order of approximately n^b.
· To predict the run time of a program, multiply the last observed run time by 2^b and double the n, so repeat. If you want the predicted input model to be not a power of n multiplied by 2, you can adjust the scale accordingly.
2. Understanding the growth of the program's uptime can provide you with accurate information to understand the limits of the size of the problem you can solve.
3. Forecasts based on an increasing order of magnitude function:
Describe |
Function |
Coefficient is 2 |
Coefficient is 10 |
Linear level |
N |
2 |
10 |
Linear logarithm level |
Nlogn |
2 |
10 |
Square level |
N^2 |
4 |
100 |
Cubic level |
N^3 |
8 |
1000 |
Index level |
2^n |
2^n |
2^9n |
Algorithm (4th edition)-1.4.6 times magnification test