Current location - Training Enrollment Network - Mathematics courses - Three knowledge points (algorithms (sorting problems and diversity of algorithms) are required in senior one mathematics.
Three knowledge points (algorithms (sorting problems and diversity of algorithms) are required in senior one mathematics.
Characteristics of 1. algorithm

(1) certainty: the certainty of the algorithm means that every operation in the algorithm is clear, not vague or ambiguous, and the algorithm will definitely produce clear results after execution;

(2) finiteness: the finiteness of the algorithm means that the algorithm must be able to solve the problem in a limited number of steps and cannot be executed indefinitely;

(3) Feasibility: The feasibility of the algorithm means that the algorithm must be effective, feasible and reusable for solving a certain kind of problems.

2, the program block diagram

The basic program box consists of a start box, an input box, an output box, a processing box and a judgment box. The startup box is indispensable for any process, and the input box and output box can be used anywhere in the algorithm that needs input and output. The picture box in the program block diagram represents various operations, the words and symbols in the picture box represent the contents of the operations, and the streamline with arrows represents the order of the operations.

(1) sequence structure

Sequence structure describes the most natural structure and the most basic structure.

Its characteristics are: from sentence to sentence, from box to box, from top to bottom.

Sequence, can't jump, can't look back, as shown in figure 1 is the sequence structure.

Schematic diagram, its function is: box A and box B are executed in turn, only when

After executing Block A, you can continue to execute Block B. 。

(2) Select the structure

Selection structure is a control structure that selects different instructions according to specified conditions. The choice structure and classification treatment in practical problems completely correspond to the classification discussion thought in mathematical thought.

(3) circular structure

A loop structure is a control structure that determines whether to execute one or more instructions repeatedly according to specified conditions. Its characteristic is that a certain processing step is repeatedly executed from a certain place according to certain conditions, and the repeated processing step is called a circular body.

3, the basic algorithm statement

Algorithms are the basis of computer science. The algorithm sentences to be learned in this part are the sentences needed to convert the algorithm into a program language that the computer can understand and a program that can be realized on the computer, and its function is to realize the conversion between the algorithm and the computer.

(1) assignment statement

An assignment statement is a statement used to indicate that a specific definite value is assigned to a variable. The general format of assignment statement is: variable name = expression.

The assignment statement should also pay attention to the following points: ① The left side of the assignment number can only be a variable name, not an expression; ② The left and right assignment numbers cannot be interchanged; ③ Algebraic expressions (or symbols) (such as simplification and factorization) cannot be calculated with assignment statements. ); The meaning of assignment number is different from that of mathematical equal sign.

(2) Enter the report

Input statements are mainly used to input the initial data of variables. The general format of an input statement is: variable = input ("prompt content"). The Input statement requires that the input value can only be a concrete constant, not a function, variable or expression.

(3) Output statement

Any algorithm to solve the problem needs to output the result, which requires an "output statement" to control the output. The output statement mainly includes the PRINT statement, and the result can be displayed on the screen by using the PEINT statement.

(4) Conditional statement

Conditional statements are algorithmic statements that deal with the logical structure of conditional branches. Computers usually execute statements in sequence in programs, but sometimes it is necessary to decide which statements to execute according to whether given conditions are met.

(5) Circular statement

Loop statement is a programming language used to deal with the loop structure in the algorithm. When the program repeats operations regularly or some statements need to be executed repeatedly, it needs to be controlled by loop statements. Two kinds of loop statements are usually used in. Basic programming languages: WHILE loop and UNTIL loop.