Question: This project requires that you know how to determine the actual time taken for a method to execute. Write a test program for the bag

This project requires that you know how to determine the actual time taken for a method to execute. Write a test program for the bag class from Section 9.5. The program should allow the user to specify an integer n. The program then adds n randomly selected integers to a bag and counts the number of occurrences of each integer between 1 and n, keeping track of the amount of time needed for the entirety of these operations. Also use the test program to test one of the earlier bag implementations. Graph the results of your tests on a plot that has elapsed time on the y-axis and n on the x-axis. (In the next chapter, we will do an analysis to explain these times.)

Step by Step Solution

3.33 Rating (165 Votes )

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock

To test the bag class we can create a new class that will handle the testing process This class will ... View full answer

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 Data Structures and Other Objects Using Java Questions!