1 Logical Structure

Logical structure is the relationship between data elements in an index object. Logical structures are divided into the following four types:

1.1 Collection Structure

Data elements in a collection structure have no previous relationship other than that they belong to the same collection. Each element data is equal, and their common attribute is “belong to the same set”. Set relationships in data structures are similar to sets in mathematics.

1.2 Linear Structure

The data elements in a linear structure were previously one-to-one.

1.3 Tree Structure

The data elements in the tree structure previously had a one-to-many hierarchical relationship.

1.4 Graph Structure

The data elements of a graph structure are many-to-many relationships.

As can be seen from the above example, logical structure is specific to a specific problem. It is to solve a problem and select an appropriate data structure to represent the logical relationship between data elements on the basis of understanding the problem.

2 Physical Structure

The physical structure is the storage form of the logical structure of the data in the computer. It’s actually how to store data elements in the computer’s memory. The data storage structure should correctly reflect the logical relationship between data elements. There are two types of storage structure: sequential storage and chain storage.

2.1 Sequential Storage

Sequential storage means that data elements are stored in contiguous locations, and the logical and physical relationships between the data are consistent. This storage structure is very simple, in fact, is queuing, each person occupies a small space, no one cut in line.

2.2 Chain storage structure

It would be nice if it were all that simple, but in reality, there are always people who jump the queue or give up the queue, so that the whole structure is changing all the time, and in this case, sequential storage is not scientific. In places like banks, there is a queuing system. Everyone gets his/her number first, then waits for your number to be called and then sees a doctor. During the waiting period, you can go wherever you want, as long as you come back in time. A chained storage structure stores data elements in any set of storage units, which can be contiguous or discontiguous. The storage relationships of data elements do not reflect their logical relationships, so we need to use a pointer to store the address of the data elements, so that the location of the associated data elements can be found through the address.