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
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started