[Data structure] The content of the data structure

The content of the data structure

Logical structure, storage structure, operation combination (a group of operations)

1. Logical structure

1. Linear structure

Logically, each node has a one-to-one relationship.
There are linear tables, stacks, queues, strings, arrays

1.2 Non-linear structure

Logically, a node element may have multiple direct predecessors and multiple direct successors, many-to-many.
There are trees and pictures

2. Storage structure

2.1 Sequential storage structure

concept

Both logically and physically are adjacent to each other, and are generally implemented by arrays.

advantage

(1) The physical storage space is adjacent, the space utilization is high, the storage density is large, and the storage space is saved.
(2) Random access to the elements in the table, and high efficiency in finding data.

Disadvantage

When inserting or deleting data, a large amount of data is moved.

2.2 Chain storage structure

concept

Logically adjacent, not necessarily adjacent physically. It is generally implemented with a linked list, and each node is composed of a data field and a pointer field.

advantage

It is flexible to insert and delete data (no need to move the node, just change the pointer in the node).

Disadvantage

(1) Compared with the sequential storage structure, the storage density is lower, and each node is composed of two parts, which increases the storage space.
(2) Searching data is slower than sequential storage structure.

3. Combination of operations (a set of operations)

Common basic operations: add, delete, modify, and check

4. Four basic structures of data structure

4.1 Linear structure

One-to-one
linear table, stack, queue, string, array.
Insert picture description here

4.2 Tree structure

One to many
Insert picture description here

4.3 Figure

Many to many
Insert picture description here

4.4 Collection

The data elements have no other relationship except that they belong to the same set.
Insert picture description here

Guess you like

Origin blog.csdn.net/m0_46630468/article/details/113499199