← Quiz: Java Collections (List and Set): all 10 questions
Quiz: Java Collections (List and Set) · Question 3 of 10
What is the time complexity of get(i) on an ArrayList?
What is the time complexity of get(i) on an ArrayList?
- A.O(1)
- B.O(n)
- C.O(log n)
- D.O(n²)
Answer & explanation
Correct answer: O(1)
ArrayList is backed by an array, so index access is direct.
Can you get the rest right without peeking?
Take the timed Quiz: Java Collections (List and Set) quiz free. Pass it to earn XP and count towards your certificate.
Start the quiz →