Introduction

2016.10.02

 

I rubbed the data structure of teacher Liu Lijue before, but due to the job search, the promotion of the campus ambassador and the learning and competition of Lan Jie, la la la, there are so many excuses anyway. Well, let's take a good look at the book on National Day.

Definition of data structure:

Data structure is a science that studies the operation objects of computers and their relationships and operations in non-numerical programming problems .

 

Common data structures are: lists, arrays, stacks, queues, trees, graphs, strings, and files.

1. Data : The general term for all symbols that can be input into a computer and processed by a computer.

2. Data Element (Data Element): It is an "individual" in the data (collection), which is usually considered and processed as a whole in the computer, and is the basic unit discussed in the data structure.

3. Data Object: A collection of data elements with the same nature.

4. Data Structure: The abstract interrelationship between data elements and the representation of this relationship in the computer.

 

Classification of data structures:

From relational or structural points, data structures can be classified into the following four categories:

Set : There is no other relationship between data elements except "belonging to the same set"

Linear structure : one to one, such as linear list, stack, queue

Tree structure : one to many, such as tree

Image structure : many to many, as shown in the figure

 

The data structure includes two aspects: "logical structure" and "physical structure":

Logical structure: It is a description of the logical relationship between data elements, which can be represented by a set of data elements and several relationships defined on this set.

Physical structure (Storage structure): It is the representation and realization of the logical structure in the computer, also known as the "storage structure".

 

The data structure is a two-tuple: DS=(D,S)

where: D is the finite set of data elements and S is the finite set of relations on D.

The representation (image) of the data structure in the computer is called the physical structure of the data, also known as the storage structure.

Sequential mapping (Sequential mapping): the successor relationship is represented by relative storage location

Chaining mapping: the successor relationship is represented by additional information (pointer)

 

Data type : A data type is a general term for a set of values ​​and a set of operations defined on this set of values.

Algorithms :

An algorithm is a finite-length sequence of operations prescribed to solve a certain type of problem. An algorithm must satisfy five important characteristics:

1. Finiteness (finiteness), 2.Definitess (determinism), 3.Effectivess (feasibility) 4.Input (with input) 5.Output (with output)

When designing an algorithm, you should generally consider achieving the following goals:

1. Correctness 2. Readability 3. Robustness 4. High efficiency and low storage requirements

 

Estimation of the time complexity of the algorithm

In general, the number of times the original operation is repeated is some function f(n) of the problem size (problem size) n. In this column, f(n)=n*2, so the time scale of the algorithm is denoted as: T(n)=O(f(n)).

The space complexity of the algorithm is defined as:

                       S(n)=O(g(n))

Indicates that as the problem size increases, the amount of memory required to run the algorithm grows at the same rate as g(n).

Guess you like

Origin http://10.200.1.11:23101/article/api/json?id=326945364&siteId=291194637