C language programming-basic concepts of algorithms

The basic concept of the
algorithm. The characteristics of the algorithm
are finite: an algorithm must end after a few more steps, and it has a finite time to complete, and cannot be executed indefinitely.
Determinism: every step of the algorithm has a definite meaning , Every process cannot be bifurcated.
Feasibility: every step should be able to run effectively and the algorithm is executable.
Input: an algorithm should have zero or more inputs.
Output: an algorithm should have one or more outputs.
The pros and cons of the algorithm
1. Correctness
The algorithm written should be able to meet the requirements of the specific problem. For any legal input, the algorithm will get the correct result
2. Readability After the
algorithm is written, it should become concise and easy Understand
3. Robustness
4. Time complexity and space complexity
algorithm description
1. Sequence structure: simple sequence structure
2. Selection structure: branch structure
3. Loop structure: Repeat a series of operations until the condition is not established. Loop The
three basic structures have only one entry and one exit. Every part of the structure may be executed, and there will be no endless loop.

The basic concept of the algorithm includes the characteristics of the algorithm: finiteness, certainty, feasibility, input and output in 5 aspects

Sequence structure:
Input data
Processing data:
Usually corresponding to the assignment operation
Output data
characteristics:
Write the corresponding statements in the order of solving the problem. The
execution sequence is from top to bottom and executed in sequence.
Select structure (branch structure)

Guess you like

Origin blog.csdn.net/weixin_45743004/article/details/103705306