[Solved]-Question 1 N Assignment Compare Performance Three Similar Data Structures Array Arraylist Q37275972
Please use Java programming language to complete thefollowing question:

Question #1 n this assignment, we will compare the performance of three similar data structures: array, ArrayList and LinkedList. For these three data structures, we will measure the time it takes to create and initialize an object with one million Integer values. To measure the execution time of a code block, you call the method System.nanoTime () before and after the code block and the difference between the returned values is the time taken to execute the code block. The following code snippet shows how to measure the execution time of a for loop: long startTime – System.nanoTime for (int iter = 0; iter < 1000000; iter++) { long endTime – System.nanoTime long exeTime = endTime – startTime ; System.out.println (“Execution Time: “+ exeTime): Create a class named “CompareTimes”. For each of the three data structures (array, ArrayList and LinkedList), create a method that returns the time it takes to create an object from that data structure and initializing it with the numbers from 0 to 999999. Then, display the results similar to the below sample output: Array: 54952999 ArrayList: 82641648 LinkedList: 127078910 The above values depend on many factors, and you are not likely to get the same numbers Show transcribed image text Question #1 n this assignment, we will compare the performance of three similar data structures: array, ArrayList and LinkedList. For these three data structures, we will measure the time it takes to create and initialize an object with one million Integer values. To measure the execution time of a code block, you call the method System.nanoTime () before and after the code block and the difference between the returned values is the time taken to execute the code block. The following code snippet shows how to measure the execution time of a for loop: long startTime – System.nanoTime for (int iter = 0; iter
Expert Answer
Answer to Question #1 n this assignment, we will compare the performance of three similar data structures: array, ArrayList and Li… . . .
OR

