Question
Input System.currentTimeMillis() to your code to get the run time of the following algorithms 1. public static int[] mystery2(int[] list) { for ( int i
Input System.currentTimeMillis() to your code to get the run time of the following algorithms
1.
public static int[] mystery2(int[] list) {
for (int i = 0; i int j = list.length-1-i; int temp = list[i]; list[i] = list[j]; list[j] = temp; } return list; } 2. public static int[] mystery4(int[] list) { int[] result = new int[2*list.length]; for(int i = 0; i result[2*i + 1] = list[i]/ 2; } return result; } 3. public static void mystery6(ArrayList for(int i = 0; i list.add(i+1, first); 4. public static void mystery8(ArrayList for(int i = 0; i list.add(i%10,"Hello World"); list.set(i%20,"nothing"); list.remove(list.size()%30);
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access with AI-Powered 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