Introduction to Data--linear table

Source: Internet
Author: User

A linear table is a linear structure, a poor sequence of n data elements, a data element called a node, the meaning of each data element in a linear table, which differs in different applications, but has the same characteristics as the data element in the same linear table.

The following figure summarizes the main contents of chapter two, which are used to summarize and recall, and to consolidate learning:


The basic operations of the linear table include initialization, table length, reading table elements, positioning, inserting, deleting and other basic operations, different storage structure implementation details may be different.

The linear table is stored in sequential storage and chained storage.

The storage of sequential storage is the simplest, the logical order corresponds to the storage order, and the array is one of the performance of the sequential table. Sequential storage operations including insertion, deletion and positioning, this part of the algorithm to understand the code on the book is better, in the linear table of the sequential storage algorithm, the data elements of the comparison and the number of moves is an important indicator, the fewer the less the less moving, the better the algorithm.

Chained storage: Common linear tables are chained to a single-linked list, a circular link list, and a double-loop linked list. The nodes in the list are divided into two parts: the domain and the pointer field, the data of the value Place node, and the storage address of the successor node in the Pointer field. It is visible that the chain structure of the logical order! = stores the order in which adjacent nodes are connected by the pointer field. The operations of chained storage include initialization, table length, reading table elements, inserting and deleting basic operations, which are also connected to other types of lists.

comparison : For some basic operations, the time complexity and spatial complexity of sequential storage is comparable to chained storage, where sequential storage is less expensive when locating elements by location. However, learning the operating system principle we know that in memory is a continuous space, the address is continuous. When using sequential storage to implement the algorithm, it is necessary to open a fixed space to operate, which creates a waste of memory space, and sometimes not so much space and must have so much space, memory address may be cut, resulting in the overall effectiveness of the system under.

And the chain storage implementation method through the pointer domain dynamic link, full use of memory in some small space, the memory requirements are small and the operation without prior allocation of space, greatly improve the memory utilization, the optimization of the whole algorithm has a great help. So the vitality of chained storage is higher than the sequential storage.

Copyright NOTICE: This article for Bo Master original article, without Bo Master permission not reproduced.

Introduction to Data--linear table

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.