Question: Consider this code that creates some Location objects 7. Suppose we implement the IntArrayBag class using two partially-filled, parallel ar arrays instead of a single
7. Suppose we implement the IntArrayBag class using two partially-filled, "parallel ar arrays instead of a single (partially-filled) array. The first array, data, holds the values of the items in the bag and the second array, dataCounts, holds a count of the number of times that the associated item is in the bag. In other words, data[i] is an integer in the ba and datacounts (1] is the number of times that integer is in the bag g, We assume that there is an instance variable manyDataItems that tells us how many of the entries from the partially-filled arrays data and dataCounts are used to hold items from the bag (so manyDataItems
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
