JCF Time Complexities Flashcards
1
Q
ArrayList: set(i, x)
A
O(1)
1
Q
ArrayList: get(i)
A
O(1)
2
Q
ArrayList: add(i, x)
A
O(1+n-i)
3
Q
ArrayList: remove(i)
A
O(n-i)
4
Q
LinkedList: all operations
A
O(1+min{i,n-i})
5
Q
HashSet: all operations
A
O(1)
6
Q
TreeSet: all operations
A
O(logn)
7
Q
TreeSet(Sorted): all operations
A
O(logn)
8
Q
HashMap: all operations
A
O(1)
9
Q
TreeMapp^3: all operations
A
O(logn)
10
Q
ArrayDeque: all operations
A
O(1)
11
Q
LinkedList(Deque): all operations
A
O(1)
12
Q
ArrayDeque(Queue): all operations
A
O(1)
13
Q
LinkedList(Queue): all operations
A
O(1)
14
Q
PrioityQueue: add(x)
A
O(logn)