The algorithm is the step to solve the problem; the program is the code implementation algorithm of the algorithm depends on the program to complete the function; the program needs the algorithm as the soul
The program is the result, and the algorithm is the means (the arithmetic method used to write a good program). The same procedure for writing a function, using different algorithms can make the program much smaller and more efficient. So the algorithm is the essence of programming.
Algorithm + Data Structure = Application.
The algorithm is the core of programming. The quality of the algorithm largely determines the efficiency of a program. A good algorithm can reduce the time complexity and space complexity of the program. First choose a good algorithm, and then cooperate with a suitable data structure, so the efficiency of the program will be greatly improved.
Algorithms and programs are finite sequences of instructions, but: programs are algorithms, and algorithms are not necessarily programs.
The main difference is:(1) In the language description, the program must be written in the prescribed programming language, and the algorithm is arbitrary;
(2) In terms of execution time, the steps described by the algorithm must be limited, and the program can be executed indefinitely.
An algorithm is a description of a particular problem solving step, which is a finite sequence of instructions.
Simple algorithm example
Example: Seek 1*2*3*4*5
Step 1: First find 1*2 and get the result 2.
Step 2: Multiply the product 2 obtained in step 1 by 3 to obtain the result 6.
Step 3: Multiply the product 6 obtained in step 2 by 4 to obtain the result 24.
Step 4: Multiply the product 24 obtained in step 3 by 5 to obtain the final result 120.
Summary of algorithm and programming knowledge points1. The concept and characteristics of the algorithm.
(1) The concept of a paraphrase algorithm: specific, limited methods and steps to solve a problem
(2) Explain the main features of the algorithm: finite (steps are finite), deterministic (each step has the exact meaning), feasibility (each step is feasible), zero or more inputs and Have one or more outputs.
(3) Describe the general process of solving problems with algorithms: The general process of solving problems by computers: analyzing problems (determining what to do with computers), finding ways and means to solve problems (solving how to do it), and processing with computers to solve problems with algorithms The general process: demand analysis (what to do), determine the algorithm (mainly how people do it), write the program (how the computer does it), and debug and maintain the machine (do better)
2. The description method of the algorithm; the drawing method of the flow chart; the flow chart is used to describe the algorithm.
(1) enumerate the description method of the algorithm (using natural language description, flow chart description, programming language and pseudo code description);
(2) List commonly used flow chart symbols and entry and exit number start and stop frames, input and output frames, processing frames, judgment boxes, and flow lines
3. The difference between constants and variables.
(1) Retelling the concepts of constants and variables;
Constant: equivalent to a constant in mathematics, does not change the amount of value in the program run
Variable: equivalent to the variable in the function, the amount of value can be changed during the running of the program
(2) List the basic types of data (integer, real, character, logical, etc.);
Integer: equivalent to an integer or a variable used to store an integer; real type: equivalent to a real number or a variable used to store real numbers; character type: data of a non-data value type (judgment: generally cannot be used to add, subtract, multiply, Logical type: name, student number, phone number, ID number, etc.: data connected by relational operators and logical operators, only true (1) and false (0) two results
Compare the difference between variable name and variable value: Max=5: variable name is Max, its value is 5; A(1)=9: A(1) is the subscript variable
4. The role and characteristics of variables; setting and using variables.
(1) Describe the basic functions and characteristics of variables: the role of saving data; characteristics: inexhaustible, one charge will fall.
(2) List the basic rules for naming variables: beginning with an English letter followed by a letter or number or underscore, the system reserved word cannot be used
(3) Assign an value to the variable using an assignment statement;
LET variable name = expression, first calculate the expression, then assign the result to the left variable, the general LET omitted
5. Operators, prioritization of operations, and expressions.
(1) List the operators and arithmetic rules of various types of operations (arithmetic, character, relation, logic); arithmetic operators: +, -, * (multiply), / (division), ^ (power), mod (a Mod b finds the remainder of a÷b) Character operator: +(connector)"I am "+"No.1"→"I am No.1" Relational operators: ",", =, "" (not Equal to), ≥ (when writing should be written as "=), ≤ logical operators: NOT (non/inverted), AND (and / and / equivalent to multiplication), OR (or / equivalent to addition)
(2) Differentiate the priority of each type of operator; Arithmetic operation: ( ) → function → power → *, / → mod → +, -
Logical operation: ( ) → NOT → AND → OR The result of the logical operation is only true and false. The convention on the textbook is true to 1, and the result is 0. First arithmetic operation → character → relationship → logic
(4) List commonly used expression types: also divided into arithmetic, characters, relations and logical expressions
Liquid Crystal Display For Instrument
Liquid Crystal Display For Instrument,Large Industrial Precision Lcd Display,Small Industrial Body Thin Lcd Display,Precise Liquid Crystal Display
Dongguan Yijia Optoelectronics Co., Ltd. , http://www.everbestlcdlcm.com