Program Design = Data Structure + Algorithm
Data structure:It is a set of one or more specific relationships between data elements. (The relationship refers to the logical structure, and the set refers to the physical structure );
A. Logical Structure
Set: there is only one set of data elements.
Linear Structure: there is a one-to-one relationship between data elements.
Tree Structure: One-to-multiple relationship exists between data elements.
Graphical structure or mesh structure: there are multiple to multiple relationships between data elements
B. Physical Structure (storage structure)
Sequential storage: data elements are stored in address-contiguous storage units. The logical and physical relationships between data are consistent (arrays)
Chained storage: data elements are stored in any storage unit. These storage units can be continuous or non-continuous.
Algorithm:It is a description of the steps to solve a specific problem. In a computer, it is represented by a finite sequence of commands, and each command represents a single active multiple operations. This is just a trick and a way to solve the problem.
A. algorithm features:
Input parameters
Output, can be printed, and can return values
After a finite step is completed, each step is completed within an acceptable period of time.
Certainty, each step has its definite meaning, and there will be no ambiguity, under certain conditions
Execute the same execution path. The same input can only have unique output results.
Feasibility each step can be completed through a limited number of executions
B. algorithm design requirements:
Correctness
The algorithm program has no syntax error.
Valid input can produce output that meets requirements
Invalid input can produce descriptions that meet specifications
All testing inputs that are intentionally difficult have output results that meet the requirements.
Readability: easy for others to read and modify.
Robustness: when the input is invalid, relevant processing can be performed instead of crashing.
High time efficiency and low storage capacity
Gaussian algorithm
Data Structure and algorithm introduction notes