In a program, it is often necessary to manage and make a group (usually the same type of) data element as a whole, to create this element group, to record them, to pass in the outgoing function, and so on.? The number of elements contained in the group data may vary (you can add or remove elements).
For this kind of demand, the simplest solution is to treat such a group element as a sequence,? The position and order of the elements in the sequence, representing some meaningful information in the actual should, or some kind of relationship between the data.
Like this? The organization of the group sequence element, which we can abstract as a linear table. A linear table is a collection of elements of a certain kind, and also records the order relationships between elements. Linear table is the most basic data structure, in the actual program should?? Frequently, it is often used as a basis for the implementation of more complex data structures.
According to the actual storage of the linear table, there are two kinds of implementation models:
-
- Sequential table, in which elements are stored sequentially in the block contiguous storage?, the order relationships between elements are represented by their order of storage.
- A linked list that stores elements in a series of storage blocks constructed from links.
Why a linked list is required:
The construction of sequential tables needs to know the data beforehand?? To apply for a continuous storage space, in the case of an expansion, it is necessary to move the data, so that it is not very flexible. The linked list structure can fully benefit the computer memory space for flexible memory dynamic management.
Definition of a linked list:
Linked list (Linked list) is the basic data structure, which is a kind of linear table, but it is not like sequential table, the data is stored continuously, is it in each node (data storage unit)? The location information (that is, the address) of the node is stored.
Linked list of Python data structures