Algorithm refers to an accurate and complete description of a problem-solving solution. It is a series of clear instructions for solving a problem. The algorithm represents a systematic method to describe the strategic mechanism for solving the problem; the instructions in the algorithm describe a calculation. , when it runs, it can start from an initial state and initial input, go through a series of limited and clearly defined states, and finally produce output and stop at a final state.
#In layman's terms, it means being able to obtain the required output within a limited time for a certain standard of input. (Recommended learning: PHP Video Tutorial)
If an algorithm is defective or not suitable for a certain problem, executing this algorithm will not solve the problem. Different algorithms may use different time, space, or efficiency to complete the same task. The quality of an algorithm can be measured by its space complexity and time complexity.
The instructions in an algorithm describe a computation that, when run, can start from an initial state and a (possibly empty) initial input, go through a limited and clearly defined series of states, and finally produce an output and Stop at a final state. The transition from one state to another is not necessarily deterministic. Some algorithms, including randomized algorithms, contain random inputs.
Features
An algorithm should have the following five important characteristics:
Finiteness
(Finiteness)
The finiteness of the algorithm means that the algorithm must be able to terminate after executing a limited number of steps;
Accuracy
(Definiteness )
Each step of the algorithm must be clearly defined;
Input
(Input)
An algorithm has 0 or more inputs to describe the initial situation of the operation object. The so-called 0 inputs mean that the algorithm itself sets the initial conditions;
Output items
( Output)
An algorithm has one or more outputs to reflect the results of processing the input data. An algorithm without an output is meaningless;
Feasibility
(Effectiveness)
Any computational step performed in the algorithm can be Decompose it into basic executable operation steps, that is, each calculation step can be completed within a limited time (also called effectiveness).
For more PHP-related technical articles, please visit the PHP Graphic Tutorial column to learn!
The above is the detailed content of what is algorithm. For more information, please follow other related articles on the PHP Chinese website!