Understanding algorithms is the soul of programming: Algorithms are the basis for computers to process information, because computer programs are essentially algorithms, telling the computer the exact steps to perform a specified task.
Understanding algorithms is the soul of programming:
Algorithms are the basis for computers to process information, because of the nature of computer programs It's the algorithm that tells the computer the exact steps to perform a given task, such as calculating an employee's salary or printing a student's transcript. Typically, as an algorithm processes information, data is read from input devices, written to output devices, and possibly saved for later use.
The famous computer scientist Worth proposed the following formula.
Data structure algorithm = program
In fact, a program should be programmed using structured programming methods and expressed in a certain computer language. Therefore, it can be expressed by the following formula.
Program = algorithm, data structure, programming method, language and environment
The four aspects in the above formula are the knowledge that a programming language should have. Among these four aspects, the algorithm is the soul, the data structure is the processing object, the language is the tool, and programming needs to use appropriate methods. Among them, algorithms are used to solve the problems of "what to do" and "how to do it". In fact, the operation statements in the program are the embodiment of the algorithm. Therefore, if you don't understand the algorithm, you can't talk about programming. Data is the object of operation, and the description of the operation is the operation step. The purpose of the operation is to process the data to obtain the desired results. To give a simple example, a chef needs a recipe to make dishes. The recipe should generally include: ① ingredients (data), ② operating steps (algorithm). In this way, dishes with different flavors can be processed from the same raw materials.
Related learning recommendations: Programming video
The above is the detailed content of How to understand that algorithms are the soul of programming. For more information, please follow other related articles on the PHP Chinese website!