Junior — Middle
What is the time complexity when accessing an element by index in an ArrayList data structure?
sobes.tech AI
Answer from AI
In the ArrayList data structure, accessing an element by index has a time complexity of O(1), which is constant time. This is because ArrayList is based on an array, and access to an element by index is done directly through address arithmetic without traversing other elements.