Chapter 2 Algorithm

algorithm

Algorithm: An algorithm is a description of the steps to solve a specific problem, which is expressed in a computer as a finite sequence of instructions, and each instruction represents one or more operations

Characteristics of the algorithm

1. Input and output: The algorithm has 0 or more inputs and at least one or more outputs.
2. Infinite: It means that the algorithm automatically ends after executing a finite step without an infinite loop, and every step All are completed within an acceptable time frame.
3. Determinism: Every step of the algorithm has a definite meaning, and there will be no ambiguity.
4. Feasibility: Each of the algorithms must be feasible, that is In other words, each step can be completed by executing a limited number of times.

Algorithm design requirements

1. Correctness
2. Readability
3. Robustness
4. Time efficiency and low storage capacity

Algorithmic measurement method

Pre-analysis and estimation method: Before the computer program is compiled, the algorithm is estimated according to the statistical method.

The running time of a program depends on the quality of the algorithm and the input scale of the problem. The input scale of the problem refers to the amount of input.
When analyzing the running time of the program, the most important thing is to treat the program as independent of the programming language Algorithm or series of steps.

Guess you like

Origin blog.csdn.net/mogbox/article/details/109135776