Data structure - concept summary

Data structures concept summary

Data Structures + Algorithms = Programs

A data structure

1. Basic concepts:

Data structure is stored in the computer, data is organized. Data structure refers to the presence of one or more data elements of the particular relationship between each set

2. The logical structure data structure into four categories:

Collection structure, linear structure, a tree structure, the structure of FIG.

3. The data structure of the physical structure of two types:

Sequential storage structure and chain storage structure.

4. The use of learning data structure:

Data structures play a connecting link between the assignment in the class system in computer science, skilled use of data structures can make the program run faster and more smoothly
mind map:

II. Algorithm

1. Definitions:

Description of the steps for solving specific problems, it is a specific sequence of instructions, each instruction represents one or more operations

2. Features:

There are poor, certainty, feasibility, input and output.

3. A description of the algorithm:

Natural language, a flowchart, programming languages, pseudocode.

4. Analysis of Algorithms:

(1) algorithm design goals:

Accuracy, workability, high readability, robustness, efficiency and low storage time

(2) two ways to measure the efficiency of the algorithm is:

Later statistics (the program run again):

You must perform the procedure, and there are other factors to cover up the nature of the algorithm

Prior estimation (software and hardware related factors aside, considering only the efficiency of the algorithm itself):

Algorithm execution time = the number of basic arithmetic operation time *

Basic arithmetic: arithmetic is considered generally within the deepest loop

(3) algorithm efficiency analysis:

Execution time of the algorithm may be calculated by the number of basic operations performed

Time Complexity: mark "O", indicate the scale of the problem with n increases, the same algorithm execution time of growth and f (n) growth rate.

Typically, in view of the operational space is more abundant, often the time complexity of the algorithm as a measure of the merits of

Constant Order: O (1): Basic number of operations has nothing to do with the scale of the problem. Note: O (1) does not represent a calculation times

The time complexity of the relationship between common algorithm: O (. 1) <O (logN) <O (n-) <O (nlogn) <O (n- 2) <O (n- . 3)

Progressive time complexity of the algorithm means: as the problem size increases, the growth trend in the execution time of the algorithm

(4) analysis algorithm storage space:

Space complexity: measurement algorithms during operation of the temporary occupation of space, problems are generally a function of the size of n s (n) = O (g (n)).

Time complexity and space complexity of the interaction, a good time complexity could lead to more take up storage space.
mind Mapping:

III. Linear table

Basic concepts of the linear form:

Linear table is the simplest, most commonly a linear structure, a linear structure is an ordered relationship between data elements

Table 2. Linear logical structure:

A finite sequence of data elements having the same characteristics: Definitions

3. The basic operation of the linear form:

Initialization InitList (& L), destruction DestroyList (& L), it is determined whether the empty ListEmpty (L), the output DisList (L), returns the number of elements in ListLength L (L)

4. The linear form of sequential structure:

Using a contiguous memory address space, in a logical sequence the linear elements in the table are sequentially stored corresponding elements

Features:

Logically adjacent and physically adjacent addresses, to achieve random access memory.

The basic sequence of operations of the table:

Initialization, destruction, access elements, search, insert, delete

The linear chain structure of the table:

Features:

Linear data element table stored in the address store any set of nodes, which are connected with a chain

structure:

= + Node Pointer Data element

Head pointer:

The first element points to a linear form, sometimes in order to simplify the insertion and deletion operations, need to set a head node before the first node

Storage density

= Low data storage density / node footprint (and therefore the list is not high storage density, compared to the sequence table for the utilization of storage space is relatively low)

The basic operation of the chain table:

Initialization, the destruction is determined whether the table is empty, output, insert, delete, create a single linked list: head and tail interpolation interpolation
mind map:

IV. Special linear form

1. Stack:

(1) basic concepts:

One end of the linear limiting list only insertion and deletion operations linear form

(2) Characteristics:

LIFO: last in, first out; is a linear relationship

(3) storage structure:

Sequential storage structure and the storage structure chain;

(4) storing content:

Stack element indicating mark stack

(5) into the stack and the stack may be inserted

2. queue:

(1) basic concepts:

One end of the linear table is restricted only to insert, delete the other end of the linear form

(2) Characteristics:

FIFO: LIFO; is a linear relationship

(3) storage structure:

Sequential storage structure and the storage structure chain;

(4) into the team and the team can be interspersed

(5) the question: "false spillover" - the team is "full", effectively empty. Solution: The circular queue

Stacks and queues are restricted operation of the linear table.
mind Mapping:

3. string:

(1) basic concepts:

Is a finite sequence of zero or more characters, the data element is a single special character linear form

(2) differs from the linear string table:

Different types of data processing:

Character string processing only type, a linear table processing any data type.

For the basic operation of different types:

The basic operation of the linear table, most of the "individual elements" as the operation target, while mostly string "whole string" operation as a whole

(3) storage structure:

1. sequential storage structure: character strings are sequentially stored in a group of contiguous storage unit
Storage either order:
Unpacked format: a memory cell stored a character
Compression formats: a memory means storing a plurality of character
2. Storage Structure: A node chain string may be stored one or more characters

String in the chain, the most basic operation of the interpolation method using the tail, the results establish return string

(3) two algorithms: BF algorithm and KMP Algorithm

mind Mapping:

Guess you like

Origin www.cnblogs.com/1360175655z/p/12588739.html