Traditional Culture Encyclopedia - Traditional festivals - Flowchart is the only graphical tool used to represent the algorithm.
Flowchart is the only graphical tool used to represent the algorithm.
There are many tools to describe the algorithm, such as natural language, traditional flow chart, N-S flow chart, pseudo code and so on.
First, the algorithm is expressed in natural language.
It is easy to understand the algorithm expressed in natural language. It is especially suitable for describing the algorithm of front-end sequence program structure. However, natural language is ambiguous, so we should pay special attention to the correctness of algorithm logic and the accuracy of operation when using it. For example, the algorithm describing natural language judges that positive integer n is a prime number.
Secondly, the algorithm is represented by flow chart.
1. Traditional flow chart
The traditional flow chart has four frames and one line, which conforms to people's thinking habits. The expression algorithm is intuitive and easy to understand (it is explained in detail in the textbook and omitted here).
2. The algorithm is represented by N-S flow chart.
Thirdly, pseudo-code representation algorithm.
It is intuitive and easy to understand to represent an algorithm with a flowchart, but it is difficult to draw it. When designing the algorithm, it may need to be revised repeatedly, and it is more troublesome to modify the flow chart. So the flow chart is suitable to represent an algorithm, but it is not ideal when it is used in the process of setting the algorithm, especially when the algorithm is complex and needs to be revised repeatedly. In order to facilitate the design of the algorithm, pseudo-code is generated.
Pseudo-code is between natural language and machine language, and the algorithm is described by words and symbols. It does not use graphic symbols, so it is convenient to write, compact in format and easy to understand. Although pseudocode is not an actual programming language, it is similar to programming language in expressive ability, which avoids the trouble of describing technical details, so pseudocode is more suitable for describing algorithms, so it is called "algorithm language" or "first language". Pseudo-code facilitates the transition to computer language algorithms (such as C language and Java).
Fourthly, the algorithm is expressed in computer language.
The ultimate goal of programming is to express the algorithm in computer language. Commonly used programming languages are C and C++. Java and so on. The following example uses C language to express the algorithm for judging whether n is a prime number.
- Related articles
- Can the music test model be extended to other grades?
- DK World Furniture Encyclopedia, 3500 color pictures, 560,000 words, a visual feast of furniture
- Advantages and disadvantages of online bookstore
- What are the online banking services?
- I am a man with curly hair. I want a perm. What kind?
- Unconventional explanation
- I like a girl and we have a good relationship. Before we talked every day, she cared about me, but recently I showed a little like her, but she is not the same as before.
- What are the characteristics of the song "The Lanting Sequence" by Jay Chou?
- Tencent per capita salary of 70,000? Netizens: the average is unreasonable, most people's wages are averaged, what do you think?
- Is 20 yuan's AY crown number a supplement in 2005?