Comparison of the advantages and disadvantages of sequential storage structure and chain-type storage structure

Source: Internet
Author: User
A comparison between sequential storage structure and chain-type storage structure Advantages and disadvantages in order to store, adjacent data elements are also adjacent to the storage address (logical and physical unity); The address of the available storage units in memory must be contiguous.
Advantages: Large storage density (=1), high storage space utilization. Disadvantage: inconvenient when inserting or deleting elements. When chained storage, the adjacent data elements can be stored at will, but the storage space is divided into two parts, one part holds the value of the node, the other part holds the pointer of the relationship between the nodes.
Advantages: Easy to insert or delete elements, flexible to use. Disadvantage: Small storage density (<1), low storage space utilization. The Usage Order table is suitable for the static operation such as lookup, and the linked list is fit for dynamic operation such as inserting and deleting. If the length of the linear table changes little, and its main operation is to find, then the sequential table, if the length of the linear table changes greatly, and its main operation is inserting, delete operation, then use the linked list. Compare Comparison of sequential table and linked list

Space-based comparison of how storage is allocated
The storage space of the sequential table is statically allocated the storage space of the linked list is dynamically allocated storage density = node data itself occupies the storage/node structure of the total memory
The storage density of the sequential table = 1 The storage density of the list < 1

Time-based comparison access mode
Sequential tables can be accessed randomly or sequentially access lists are sequential access inserts/deletes the number of elements moved
The sequential table needs to move nearly half of the element list without moving the elements, you just need to modify the pointer

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.