Question: 7. Suppose we implement the IntArrayBag class using two partially-filled, parallel arrays instead of a single (partially-filled) array. The first array, data, holds the values


7. Suppose we implement the IntArrayBag class using two partially-filled, "parallel 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 bag and dataCounts[i] is the number of times that integer is in the bag 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
