Practice question · True or false
Accessing an element by index in an array takes O(n) time.
Hints
- Ask whether the machine has to walk the list or can jump straight in.
- An address computed by arithmetic takes the same time whatever the size.
Show the answer
False
Why
Direct index access is O(1) because the address is computed from the base pointer.
Practise Lists, arrays, and structured storage
The app has 6 more questions on this lesson, and keeps your place in the course. Physics I is free to start.