Link them together by means of pointers

Source: Internet
Author: User

Computer Science an overview _j Glenn brookshear _11th Edition

An alternative to storing a heterogeneous array in a block of contiguous memory cells are to store each component in a Sepa Rate location and then link them together by means of pointers. More precisely, if the array contains three components, then we find a place in memory to store three pointers, each of WH Ich points to one of the components (Figure 8.7b). If These pointers is stored in a block starting at address X, then the first component can is found by following the Poin ter stored at location x, the second component can is found by following the pointer at location x 1, and so forth.

This arrangement was especially useful in those cases in which the size of the array ' s are dynamic. For instance, by using the pointer system the size of the first component can is increased merely by finding a area in me Mory to hold the larger component and then adjusting the appropriate pointer to the new location. But if the array were stored in a contiguous block, the entire array would has to be altered.

Implementation of implementing data structures data structure

Storing Arrays heterogeneous Arrays heterogeneous array storage

Link them together by means of pointers

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.