Logically, data structures can be divided into two categories: linear structures and non-linear structures.
The logical structure of data: refers to the data structure that reflects the logical relationship between data elements. The logical relationship refers to the before and after relationship between data elements, regardless of their storage location in the computer.
Linear structure is an ordered (ordered) set of n data elements. It has four basic characteristics:
1. There must be a unique "first element" in the set;
2. There must be a unique "last element" in the set;
3. Except for the last element, all other data elements have a unique "successor";
4. Except for the first element, all other data elements have a unique "predecessor" .
Linear structure in data structure refers to a data structure in which there is a "one-to-one" linear relationship between data elements.
Corresponding to the linear structure, the logical characteristic of the nonlinear structure is that one node element may correspond to multiple direct predecessors and multiple successors.
Commonly used linear structures include: linear list, stack, queue, double queue, array, and string.
Regarding the generalized table, it is a non-linear data structure.
Common nonlinear structures include: trees (binary trees, etc.), graphs (nets, etc.).
The above is the detailed content of What can data structures be logically divided into?. For more information, please follow other related articles on the PHP Chinese website!