Advantages and disadvantages of sequential storage structure of linear tables

Source: Internet
Author: User

Labels: Advantages and Disadvantages of linear table sequential Storage Structure

Advantages: 1. You do not need to add additional storage space to represent the logical relationship between elements in the table.

2. You can quickly access any element in a table.

Disadvantages: 1. Insert and delete operations require moving a large number of elements.

2. When the length of a linear table changes greatly, it is difficult to determine the storage space capacity.

3. Fragments of storage space ".

 

==========================================================

However, you need to note that you can quickly access the "Storage" at any location in the table. What is the difference with "insert?

The meaning of "save" is to assign a value to any position of the linear table, expressed as the program code is arr [3] = 100;

"Insert" means to insert an element at position I. For example, insert the third position of a linear table, that is, each element after the third element must move one digit backward (the length of the array is assumed to be long enough ).

For (INT I = 3; I <10; I ++ ){

Arr [I + I] = arr [I];

}

This shows that the linear sequence storage structure is suitable for applications where the number of elements does not change much, but more data is accessed.

Advantages and disadvantages of sequential storage structure of linear tables

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.