Question

Instead of using a parallel array to store values, one should consider converting this into an...

Instead of using a parallel array to store values, one should consider converting this into an array of objects. Briefly, list two challenges one might encounter when using parallel arrays that are solved when using an array of objects.

Homework Answers

Answer #1

Parallel arrays are an implicit data structure that uses two or more arrays to represent a singular array of records. Using Parallel array is a bad idea as it makes the code more fragile.

Whenever we want to add a new field , we need to add new array. If we want to pass the whole entity to another function, we need to pull all the items.

Secondly, in case of performing swap, we need to swap all the array pairs individually.

These can be overcome by using Array of objects.

As name implies Array of object stores the objects in array. An object can be represented as a single record in memory, so for multiple records array of objects must be created. The array not only hold the objects but can hold references to the object.

Know the answer?
Your Answer:

Post as a guest

Your Name:

What's your source?

Earn Coins

Coins can be redeemed for fabulous gifts.

Not the answer you're looking for?
Ask your own homework help question
Similar Questions
CAN YOU PLEASE WRITE THIS CODE IN A DIFFERENT WAY 'EASIER AND BETTER' QUESTION Using C++...
CAN YOU PLEASE WRITE THIS CODE IN A DIFFERENT WAY 'EASIER AND BETTER' QUESTION Using C++ 11. Write a function that will merge the contents of two sorted (ascending order) arrays of type double values, storing the result in an array out- put parameter (still in ascending order). The function shouldn’t assume that both its input parameter arrays are the same length but can assume First array 04 Second array Result array that one array doesn’t contain two copies of...
In C++ Employee Class Write a class named Employee (see definition below), create an array of...
In C++ Employee Class Write a class named Employee (see definition below), create an array of Employee objects, and process the array using three functions. In main create an array of 100 Employee objects using the default constructor. The program will repeatedly execute four menu items selected by the user, in main: 1) in a function, store in the array of Employee objects the user-entered data shown below (but program to allow an unknown number of objects to be stored,...
Goal:   Manage the inventory of objects sold in an online or brick and mortar store. If...
Goal:   Manage the inventory of objects sold in an online or brick and mortar store. If you can't implement all of the features of Project described in this document, implement what you can. Start by implementing the StockItem class, and its derived classes. Then add in the InventoryManager class later. In each case, the test files must be in separate classes. UML Diagram: Use Violet or other drawing software to draw the UML diagrams of each class that you use...
C++ Goals  Build single linked lists using pointers  Learn how to manipulate linked lists...
C++ Goals  Build single linked lists using pointers  Learn how to manipulate linked lists In this lab, you will create simple single linked structures consisting of Node objects. Each node will have a pointer to the next node. You will use a head pointer to keep track of the first node in the linked list, and a tail pointer to keep track of the last node in the linked list. Set both head and tail to NULL when...
This laboratory assignment involves implementing a data structure called a map. A map associates objects called...
This laboratory assignment involves implementing a data structure called a map. A map associates objects called keys with other objects called values. It is implemented as a Java class that uses arrays internally. 1. Theory. A map is a set of key-value pairs. Each key is said to be associated with its corresponding value, so there is at most one pair in the set with a given key. You can perform the following operations on maps. You can test if...
Cooperative Education--Discussion Question #1--Spring, 2018 COLLAPSE SPECIAL NOTE: You will have two weeks, instead of one,...
Cooperative Education--Discussion Question #1--Spring, 2018 COLLAPSE SPECIAL NOTE: You will have two weeks, instead of one, to complete this particular discussion question. This discussion question assignment can earn you 105 huge points, depending on the quality and timeliness of your comments and how well you follow the instructions for this assignment. Within the two weeks time period you should answer my specific discussion question (all parts of it) AND also respond to at least two other students’ comments. This will...
1-True or False: Using natural rewards that the student might encounter in real-life does not promote...
1-True or False: Using natural rewards that the student might encounter in real-life does not promote maintenance TRUE or FALSE 2-Which of the following is a good way to help your student maintain a skill? A)Incorporate the skill into play activities B) Incorporate the skill into real-life situations C)Incorporate the learned skill into a more complex skill D)All of the above 3- True or False: Incorporating a learned skill into play activities can help the student maintain the skill TRUE...
-Data Structure in C++ (Review for C++) -using vector and class In this assignment you’re going...
-Data Structure in C++ (Review for C++) -using vector and class In this assignment you’re going to build a simple “register machine”, a kind of minimal computer that only supports storing a fixed number of values (i.e., no randomly-accessible “main memory”). Your machine will consist of an input loop that reads lines of input from the user and then executes them, stopping when the user quits (by executing the stop command). Each line of input consists of a command followed...
Cpp Task: Create a class called Mixed. Objects of type Mixed will store and manage rational...
Cpp Task: Create a class called Mixed. Objects of type Mixed will store and manage rational numbers in a mixed number format (integer part and a fraction part). Details and Requirements Your class must allow for storage of rational numbers in a mixed number format. Remember that a mixed number consists of an integer part and a fraction part (like 3 1/2 – “three and one-half”). The Mixed class must allow for both positive and negative mixed number values. A...
Data For Tasks 1-8, consider the following data: 7.2, 1.2, 1.8, 2.8, 18, -1.9, -0.1, -1.5,...
Data For Tasks 1-8, consider the following data: 7.2, 1.2, 1.8, 2.8, 18, -1.9, -0.1, -1.5, 13.0, 3.2, -1.1, 7.0, 0.5, 3.9, 2.1, 4.1, 6.5 In Tasks 1-8 you are asked to conduct some computations regarding this data. The computation should be carried out manually. All the steps that go into the computation should be presented and explained. (You may use R in order to verify your computation, but not as a substitute for conducting the manual computations.) A Random...