Billions of documents to download for free
Computer secondary public basic knowledge
Basic public knowledge tutorial
Chapter 1 Data Structures and Algorithms
Algorithm: refers to an accurate and complete description of the solution.
Algorithms are not equal to programs, nor are they waiting for computer methods. The preparation of programs cannot be better than the design of algorithms.
The basic characteristics of the algorithm: it is a set of rules that strictly define the order of operations. Each rule is valid and clear.
This sequence will be terminated a limited number of times. Features include:
(2) Certainty, each step in the algorithm must be clearly defined, ambiguous explanations are not allowed, and many are not allowed.
(3) Infinite, the algorithm must be able to complete in a limited time, that is, it can terminate after executing a limited number of steps, including reasonable
Meaning of execution time;
(4) Have sufficient intelligence.
The basic elements of the algorithm: one is the operation and operation of the data object; the other is the control structure of the algorithm.
Instruction system: A collection of all instructions that a computer system can execute.
Basic operations and operations include: arithmetic operations, logical operations, relational operations, and data transmission.
The control structure of the algorithm: sequence structure, selection structure, loop structure.
Basic algorithm design method: enumeration method, induction method, recursion, recursion, reduction and recursion technology, backtracking method.
Algorithm complexity: algorithm time complexity and algorithm space complexity.
Algorithm time complexity refers to the computational effort required to execute the algorithm.
Algorithm space complexity refers to the memory space required to execute this algorithm.
1.2 Basic Concepts of Data Structure
Three aspects of data structure research:
(1) The inherent logical relationship between the data elements in the data set, that is, the logical structure of the data;
(2) When processing data, the storage relationship of each data element in the computer, that is, the storage structure of the data;
(3) Operations on various data structures.
A data structure is a collection of data elements that are related to each other.
The logical structure of the data includes:
(1) Information representing data elements;
(2) Represents the before-after relationship between each data element.
The data storage structure includes order, link, and index.
Linear structural conditions:
(1) There is only one root node;
(2) Each node has at most one antecedent, and at most one antecedent.
Non-linear structure: A data structure that does not meet the conditions of a linear structure.
1.3 Linear tables and their sequential storage structure
A linear table consists of a set of data elements. The position of a data element depends only on its own sequence number. The relative position between the elements is
In a complex linear table, a data element composed of several data elements is called a record, while a linear table composed of multiple records
Also called a file.
Structural characteristics of non-empty linear tables:
(1) and there is only one root node a1, it has no antecedent;
(2) There is one and only terminal node an, which has no followers;