Home  >  Article  >  What are the differences between linear lists and linked lists?

What are the differences between linear lists and linked lists?

hzc
hzcOriginal
2020-06-24 14:14:2115013browse

What are the differences between linear lists and linked lists?

Linear table (array)

The data corresponds to the elements one-to-one except for the first and last other data elements. Connect

Linked list

  • Non-continuous, non-sequential storage structure on the physical storage unit (non-continuous in memory)

  • The logical order between data elements is realized through the pointer link sequence in the linked list

  • The linked list is composed of a series of nodes (the elements in the linked list are called nodes point), the node can be dynamically generated at runtime

  • The node includes two parts: 1. Data field to store data elements

2. The pointer field that stores the address of the next node (implemented as a pointer)

Linear table is the most basic, simplest, and most commonly used data structure. The relationship between data elements in a linear table is a one-to-one relationship, that is, except for the first and last data elements, other data elements are connected end to end. The linear table has a simple logical structure and is easy to implement and operate. Therefore, the data structure of linear table is widely used in practical applications.

A linked list is a non-continuous and non-sequential storage structure on a physical storage unit. The logical order of data elements is realized through the link order of pointers in the linked list. A linked list consists of a series of nodes (each element in the linked list is called a node), and nodes can be dynamically generated at runtime. Each node consists of two parts: one is the data field that stores data elements, and the other is the pointer field that stores the address of the next node.

Compared with the linear list sequence structure, the linked list is more convenient for insertion and deletion operations.

The above is the detailed content of What are the differences between linear lists and linked lists?. For more information, please follow other related articles on the PHP Chinese website!

Statement:
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