Question: Would a LinkedList or an ArrayList perform better when run on the following code? Why? public static int min (List list) { int min list.get

Would a LinkedList or an ArrayList perform better when run on the following code? Why?

public static int min (List list) { int min list.get (0); for (int i = 1; i < list.size (); i++) { if (list.get (i) < min) { min = list.get (i); return min;

public static int min (List list) { int min list.get (0); for (int i = 1; i < list.size (); i++) { if (list.get (i) < min) { min = list.get (i); return min;

Step by Step Solution

3.46 Rating (159 Votes )

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock

The code shown would perform better w... 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 Building Java Programs A Back to Basics Approach Questions!