InterviewSolution
Saved Bookmarks
| 1. |
What is the worst case complexity of accessing an element in ArrayList?(a) O(n)(b) O(1)(c) O(nlogn)(d) O(2)This question was posed to me in a job interview.This interesting question is from Data Structures-List in section java.util – The Collections Framework of Java |
|
Answer» RIGHT option is (b) O(1) To explain I would SAY: ARRAYLIST has O(1) complexity for accessing an ELEMENT in ArrayList. O(N) is the complexity for accessing an element from LinkedList. |
|