Question: Write a program that stores 10 million random integers in a linked list and test the time to traverse that list; 1) Make a prediction

Write a program that stores 10 million random integers in a linked list and test the time to traverse that list;

1) Make a prediction as to which method is more efficient; a) Using the get(index) method or using b) 2) Using an Iterator class

2) Write code (or a program) to traverse the 10M element LinkedList by the get(index) approach

3) Write code (or a program) to traverse the 10M element LinkedList by the get(index) approach

4) Write a 1-4 paragraph about what you learned, was your prediction correct, and why. Provide any supporting details you deem necessary. You can include it in the Java source code as comments.

Remember to use the system.nanoTime() method to time your experiments.

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!