Home > Common Problem > What are the two storage structures of data?

What are the two storage structures of data?

青灯夜游
Release: 2022-01-21 14:26:28
Original
22978 people have browsed it

The two storage structures of data are: 1. Sequential storage structure, which stores logically adjacent nodes in physically adjacent storage units. The logical relationship between nodes is It is reflected by the adjacency relationship of storage units; 2. Chained storage structure, which uses a set of arbitrary storage units in the computer to store the data elements of the linear table.

What are the two storage structures of data?

The operating environment of this tutorial: Windows 7 system, Dell G3 computer.

The storage structure of data includes sequential storage structure and chain storage structure.

The sequential storage structure stores logically adjacent nodes in physically adjacent storage units. The logical relationship between nodes is reflected by the adjacency relationship of the storage units. Usually sequential storage structures are described with the help of computer programming language arrays. The main advantage is to save storage space and enable random access to nodes, that is, each node corresponds to a sequence number.

The chained storage structure uses a set of arbitrary storage units in the computer to store the data elements of the linear table. Linked storage structures are usually implemented with the help of pointer types in programming languages. It does not require logically adjacent elements to be physically adjacent; each node is composed of a data domain and a pointer domain; because clusters are randomly assigned, this also reduces the probability of overwriting after data is deleted, and improves recovery possibilities.

What are the two storage structures of data?

Main differences

1. The continuity of storage units is different

chain The formula storage structure uses a set of arbitrary storage units to store the data elements of the linear table in the computer (this set of storage units can be continuous or discontinuous).

The sequential storage structure uses a set of storage units with consecutive addresses in the computer to sequentially store each data element of the linear table.

2. Different advantages and disadvantages

In terms of space

The sequence saves space compared to the chain. This is because each node in the chain structure has a pointer storage domain.

Storage operation:

Sequential support for random access, convenient operation

Insertion and deletion:

The chained one is more convenient than the sequential one (because the sequential table is also very convenient for insertion. The problem is that the insertion of the sequential table requires greater space complexity, including an index from the table header and a backward movement of the elements after the index. After the linked list is indexed, the insertion is completed)

3. Different applicable directions

Linked storage is suitable for inserting, deleting, and updating elements more frequently, while the sequential storage structure is suitable Used for frequent queries.

For more related knowledge, please visit the FAQ column!

The above is the detailed content of What are the two storage structures of data?. For more information, please follow other related articles on the PHP Chinese website!

Related labels:
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template