Suppose list1 is an ArrayList and list2 is a LinkedList. Both contains 1 million double values. Analyze the following code:
```
A:
for (int i = 0; i < list1.size(); i++)
sum += list1.get(i);
B:
for (int i = 0; i < list2.size(); i++)
sum += list2.get(i);
```
a. Code fragment A runs faster than code fragment B.
b. Code fragment B runs faster than code fragment A.
c. Code fragment A runs as fast as code fragment B.
a
Computer Science & Information Technology
You might also like to view...
The ____________________ value of the use attribute means that the attribute must always appear with the element.
Fill in the blank(s) with the appropriate word(s).
Computer Science & Information Technology
______ instructions remain on a storage medium until they are needed, at which time they transfer into memory.
A. Nonresident B. Virtual C. Sidelined D. Volatile
Computer Science & Information Technology