Current location - Training Enrollment Network - Mathematics courses - Pseudo-code of high school mathematics
Pseudo-code of high school mathematics
In fact, you just need to understand the class well and do your homework carefully. Don't be so nervous. My experience is that the final exam questions are very simple. Attention should be paid to cultivating logical thinking and imitating computers step by step. Ask me if you have any questions.

Attachment: some understanding of the algorithm in senior high school mathematics (found online, of little significance)

The algorithm belongs to the new content of the new textbook. Combining with my own teaching experience, the author talks about the understanding and knowledge of the algorithm for your reference:

1, the content of the algorithm

(1) natural languages (2) program block diagram (3) algorithm statements, in which each language has its own structure, such as sequence structure, loop structure, conditional structure, etc.

2. The position of algorithm in high school curriculum:

The design of algorithm content is divided into two parts.

One part mainly introduces the basic knowledge of the algorithm, which can be called the "three basics" of the algorithm: the basic idea of the algorithm, the basic structure of the algorithm and the basic sentences of the algorithm. Through some specific cases, the basic idea of the algorithm is introduced, so that students can understand that a series of steps are designed to solve a problem, and anyone can solve the problem by implementing these steps. This is an algorithm to solve the problem. This is a general understanding of the algorithm. The understanding of the algorithm is more related to the computer, which can complete these steps.

Algorithms generally have three basic structures: sequence structure, bifurcation structure and cyclic structure. The first two structures are easy to understand, and the circular structure is a bit difficult. It is difficult to understand the cyclic variables that reflect the cyclic process with the function idea here. In the teaching process, we must introduce concepts through specific cases and specific situations, which will make the problem very simple.

When introducing algorithm statements, we should distinguish between algorithm language and basic algorithm statements. As we know, there are many algorithmic languages used now, such as basic, q-basic, C and so on. In senior high school mathematics curriculum, it is not required to introduce algorithmic language, but only to understand basic statements, such as input statements, output statements, assignment statements, conditional statements, cyclic statements and so on. In different languages, the expressions of these sentences may be different, and the mathematics curriculum requires a recognized and unified expression, which is called pseudocode. It is easy to translate pseudocode into any algorithmic language.

There are three languages to describe the algorithm: natural language, block diagram language and basic algorithm statement.

Another part of algorithm design is to integrate the idea of algorithm into related mathematical content. In fact, the idea of algorithm is the basic idea that runs through the high school mathematics curriculum. For example, use dichotomy to find the solution of the equation; Distance from point to line, distance from point to plane, distance from line to line; The proof process of solid geometry property theorem; One-dimensional quadratic inequality; Linear programming; Wait, it's all about algorithms.

Learning and understanding mathematics with algorithmic thinking is very useful for improving mathematics literacy. I hope teachers will pay attention to it.

3, understand the assignment statement:

Assignment is one of the difficulties in the algorithm, and understanding assignment is very important for understanding the algorithm.

Assignment is to assign a value to a given variable. For example, a:=5 is to assign a value of 5 to the variable A, that is, a=5, and this assigned variable can be operated with other values. For the assignment variable A, other values can be given instead of the original value. We can use tape recording to compare homework. When we record, we can only load new recording materials by cleaning the old recording materials on the tape. Similarly, our assignment here is to clear the original value first and then assign a new value. We illustrate how to set variables and assign values to variables through an example.

Example: Design an algorithm to find the maximum number from four different numbers.

Solution: Remember that these five different numbers are A 1, A2, A3, A4 and A5, and the algorithm steps are as follows:

1, compare a 1 with a2, and record the larger number as B. 。

(In this step, b represents the maximum of the first two numbers. )

Compare B with a3, and record the larger number as B. 。

(After this step, the value of b is the largest among the first three numbers. )

Compare B with a4, and record the larger number as B. 。

(After this step, the value of b is the largest among the first four numbers. )

4. output b, and the value of b is the maximum number.

Analysis: In the four steps of the above algorithm, each step should be compared with the maximum number b obtained in the previous step to get a new maximum number. B can take different values, and b is called a variable. In the algorithm process from step 1 to step 3, we all record the larger number after comparison as B, that is, we give the value to B. This process is the process of assignment, which has two functions. First, you can constantly change the value of b, that is, put the value into b; Second, every time the value of b changes, it serves the next comparison.

4. Functions in the loop structure:

(1) loop structure is the basic structure of the algorithm.

For example, design an algorithm to output all positive integers within 1000 that can be divisible by 3 and 5. To solve this problem, the variable A should be introduced to represent the number to be output, so that A = 15N (n = 1, 2,3, ..., 66).n changes from 1 to 66, and all positive integers in 1000 that can be divisible by 3 and 5 can be used. The variable n controls the start and end of the loop, which is called the loop variable.

(2) The loop structure is another difficulty in understanding the algorithm, and the difficulty lies in understanding the loop variables.

There are two kinds of loop variables in the loop structure. One is a variable that controls the number of cycles. For example, output all positive integers divisible by 3 and 5 within 1000. In this loop structure, n is a loop variable that controls the number of loops. The other is the variable that controls the accuracy of the results. For example, the flow chart for finding the approximate solution of equation f(x)=0 in the interval [0, 1] by dichotomy algorithm requires an accuracy of. In this algorithm, accuracy is a cyclic variable that controls the accuracy of the result.

The loop variable enables the loop body to "loop", and the loop variable controls the "start" and "end" of the loop, which is the key to describe the loop structure.

The above points are a superficial understanding of the algorithm. Please criticize and correct the improper points!