ArrayList<Integer> lst = ...; int sum = 0; for (int i = 0; i < lst.size(); i++ ) sum += lst.get(i);
What is the Big O of this code?
Answer: B
Since ArrayList is basically an array in its implementation, the .get(i) operation is O(1).
Contents Page-10 Prev Next Page+10 Index