1
Programming Arrays
Students Name
University
Course Name
Professor
Date
, 2
Programming Arrays
1) Discuss the pros and cons of the use of arrays and parallel arrays and provide an
example of a real-life equivalent to an array and a parallel array
Pros of the Use of Arrays
It is easy to access an element in an array by using the index number.
In an array, it is easy to apply the search process.
Arrays provide excellent cache locality, which may significantly improve
performance.
Arrays may be used to create other data structures such as stacks, linked lists,
trees, graphs, and queues.
For all of its elements, an array allocates memory in contiguous memory
locations. Thus, memory overflow and underflow are not a concern.
Matrices are represented using 2D arrays (GeeksforGeeks, 2020).
Cons of the Use of Arrays
An array cannot be modified once declared since it is a static data structure.
One must know the elements stored in an array before allocating the memory
during initialization.
Memory is wasted when more memory is allocated than required, and less
allocation is an issue too.
Because items are allocated in consecutive locations, elements insertion and
deletion in an array are hard.
An example of a real-life equivalent to an array
Programming Arrays
Students Name
University
Course Name
Professor
Date
, 2
Programming Arrays
1) Discuss the pros and cons of the use of arrays and parallel arrays and provide an
example of a real-life equivalent to an array and a parallel array
Pros of the Use of Arrays
It is easy to access an element in an array by using the index number.
In an array, it is easy to apply the search process.
Arrays provide excellent cache locality, which may significantly improve
performance.
Arrays may be used to create other data structures such as stacks, linked lists,
trees, graphs, and queues.
For all of its elements, an array allocates memory in contiguous memory
locations. Thus, memory overflow and underflow are not a concern.
Matrices are represented using 2D arrays (GeeksforGeeks, 2020).
Cons of the Use of Arrays
An array cannot be modified once declared since it is a static data structure.
One must know the elements stored in an array before allocating the memory
during initialization.
Memory is wasted when more memory is allocated than required, and less
allocation is an issue too.
Because items are allocated in consecutive locations, elements insertion and
deletion in an array are hard.
An example of a real-life equivalent to an array