Question 1
Back to Exercise
What is the time complexity of reading arr[i] from a Java array of n elements?
- A O(n)
- B O(log n)
- C O(1) Correct
- D O(n log n)
Correct Answer: Option C
The address is computed directly from the start address and the index, so no searching is needed.
Discussion & Comments 0
Share your method, a shortcut, or ask about a step you didn't follow.
No comments yet. Be the first to share your solution!