Question: 8- Suppose that the bag class is efficiently implemented with a fixed array with a capacity of 4000, as in Chapter 3 of the class

8- Suppose that the bag class is efficiently implemented with a fixed array with a capacity of 4000, as in Chapter 3 of the class text. Choose the best description of b's member variables after we execute these statements:

bag b;

b.insert(5);

b.insert(4);

b.insert(6);

What will be the values of b.used and b.data after the statements?

A. b.used is 3, b.data[0] is 4, b.data[1] is 5, and b.data[2] is 6

B. b.used is 3, b.data[0] is 5, b.data[1] is 4, and b.data[2] is 6

C. b.used is 3, b.data[0] is 6, b.data[1] is 4, and b.data[2] is 5

D. b.used is 3, b.data[0] is 6, b.data[1] is 5, and b.data[2] is 4

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!