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
You might also like to view...
What is the range of wavelengths of visible light? What colors correspond to the shorter wavelengths?
What will be an ideal response?
Indentation in a document is established at the ________ level
A) word B) paragraph C) page D) sentence
When connecting an old HDTV without a HDMI port to a DVD player, which of the following cables would provide the best picture quality?
a. Composite b. S-video c. USB d. Component
Which of these is not among the special project risk factors described in the chapter?
A. Poor initial estimates of resources B. Conflicts among project workers C. Employee illness D. Vendor bankruptcy