Read data structure (c) (5)

Source: Internet
Author: User

The postgraduate entrance exam is finally settled, and this series can continue. View previous articleArticleThe publication date is more than January. Looking back on the experiences of this month, I still have a lingering fear. I was surprised to hear the various phenomena. Fortunately, everything has passed, and I can write an article quietly.

In the previous article, we talked about the Sequential Representation of linear tables. This time we will talk about the chained representation of linear tables. The advantage of sequential representation is obvious. It implies the logical relationship of data in the physical location of data, which is simple, direct, and powerful. However, the disadvantage is that a large amount of data needs to be moved during the insert or delete operation. To overcome this disadvantage, you can use chained storage.

Chained storage does not use physical locations to implicitly represent data relations. It adds a pointer field to describe the order relations between data. In a node, the data domain stores data information, while the pointer domain stores data relationship information. The structure is quite clear. In this way, although the disadvantages of sequential representation are overcome, there are two drawbacks at the same time. First, the amount of data to be stored increases, and second, a node cannot be accessed randomly. Therefore, there is no good or bad physical representation of a linear table. Only applicable differences are not applicable.

The author also introduced a static single-chain table when introducing chained representation. It uses arrays to store chained nodes. the pointer field of the storage node is not a pointer in C language, but a subscript of the array. This subscript specifies the position of the next data element in the array. According to the author, this description method is convenient in the advanced mode without the "Pointer" type.ProgramThe linked list structure is used in the design language. This method of description is not much different from the linked list with pointers, except that the programmer must implement the malloc and free functions on his own. To put it bluntly, This method requires programmers to manage a large piece of continuous memory. In this memory, chained storage is implemented, which mainly implements allocation and recovery.

Speaking of this, you will find that a linear table is a logical structure. Sequential Representation and chained representation are two physical representations of this logical structure. In chained representation, the specific implementation can be divided into dynamic and static linked lists. At this level, chained representation is a logical structure, while Dynamic Linked List and static linked list are two physical representations of this logical structure. It seems like tang Miao. He understands. Do you understand? In short, logic and physics are not absolute, but logic is followed by physical thinking.

In fact, computer learning has high requirements on mathematics and is also related to logical and physical thinking methods. Mathematics is used in the logic layer. The logic is clear, and the big direction is right. As for physical implementation, it is only represented by a computer, the real challenge is still at the logic level.

Related Article

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.