Parallel Arrays

Topics: Array data structure, Algorithmic efficiency, Allocation Pages: 2 (427 words) Published: May 17, 2013
Parallel arrays and arrays of structures

An array of structures are usually equivalent to parallel arrays of the components. For example, if each student record consists of an ID number and a GPA value, then a list of students can be represented as an array of structure: The same data can be stored as two arrays that "parallel" to each other, in the sense that the same index in them indicate data for the same student: Usually the first way is more natural and convenient.

Advantages and disadvantages
Against Arrays

Compared to arrays, linked data structures allow more flexibility in organizing the data and in allocating space for it. With arrays, we must choose a size for our array once and for all; this can be a potential waste of memory. A linked Data structure is built dynamically and never needs to be bigger than the programmer requires. It also requires no guessing in terms of how much space you must allocate when using a linked data structure. This is a feature that is Key in saving wasted memory. The nodes of a linked data structure can also be moved individually to different locations without affecting the logical connections between them, unlike arrays. With due care, a process can add or delete nodes to one part of a data structure even while other processes are working on other parts. On the other hand, access to any particular node in a linked data structure requires following a chain of references that stored in it. If the structure has n nodes, and each node contains at most b links, there will be some nodes that cannot be reached in less than log b n steps. For many structures, some nodes may require worst case up to n -1 steps. In contrast, many array data structures allow access to any element with a constant number of operations, independent of the number of entries.

General Disadvantages
Linked data structures also may also incur in substantial memory allocation overhead (if nodes are allocated individually) and frustrate memory...
Continue Reading

Please join StudyMode to read the full document

You May Also Find These Documents Helpful

  • Essay about It/218 Week 4 Day 5 Arrays vs Pointers Checkpoint
  • Array Essay
  • Lesson 1c Multidimensional Arrays Essay
  • A Tutorial on Pointers and Arrays in C Essay
  • Essay on Example of Array for It Students
  • Essay on 7 and Array
  • Essay about 9. Get Two Strings from User and Print the Both Strings in Such a Format That It Displays 0 Index Value of First Array Then...
  • Array Sample Program Essay

Become a StudyMode Member

Sign Up - It's Free