Sequence Table and linked list of data structures

Source: Internet
Author: User

Linear tables are divided into sequence tables and linked lists, which have the same and different characteristics. The following describes the similarities and differences between the two structures of learners. The blog frame is as follows:


A linear table, as its name implies, exists in a linear way in the memory. This sequence table is the same as the linked list. However, the sequence table continuously exists in the memory, and the physical and logical values are continuous, although the linked list is linear but not necessarily continuous (physical disconsecutive, logical continuity), the difference between the two lies in the storage method: each storage unit in the sequence table is a single data, the linked list is divided into two areas: the data domain and the pointer domain. The pointer domain stores the pointer pointing to another storage unit, and the data domain stores the data of this storage unit.


Sequence table:

Sequential table operations

Delete: delete a piece of data, and move all the subsequent data one by one

Insert: Insert a piece of data, and move all the following data one bit behind

Linked List:


Linked List category

The linked list is its name. The difference with the sequence table is that there is a direct relationship between the previous node and the next node.

From top to bottom, they are single-chain tables, circular linked lists, and double-chain tables.

Note that the last pointer field of a single-chain table is null, the last pointer field of the circular linked list points to the header node, and the double-chain table has two pointer fields, it refers to the forward and last units respectively.

Single-chain table operation

Delete a node: the pointer of the previous node of the node to be deleted points to the next node of the pointer, and then releases the resources of the node.


Insert node: 1. Create the node; 2. Point the node pointer to the next node; 3. Point the previous node to the node. The sequence cannot be reversed; otherwise, the linked list will be broken.


Double-linked table operations

Delete node: the deletion of a double-linked table is similar to that of a single-linked table. The pointer at both ends is directed to the table before deleting the node.

Insert node: As shown in the step, the order cannot be disrupted.


Comparison Between Sequence tables and linked lists

These two linear tables have their own advantages and disadvantages. The advantage of ordered tables is that they store more content in other spaces and make it easier to search for data; the advantage of the linked list is that the capacity can be dynamically allocated, inserted, and deleted.

The feeling of learning the data structure greatly supplements the doubts about arrays and so on. This is a relatively simple data structure type and will be summarized in the following articles and other data structures such as trees and charts.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.