JCF Time Complexities Flashcards

1
Q

ArrayList: set(i, x)

A

O(1)

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
1
Q

ArrayList: get(i)

A

O(1)

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
2
Q

ArrayList: add(i, x)

A

O(1+n-i)

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
3
Q

ArrayList: remove(i)

A

O(n-i)

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
4
Q

LinkedList: all operations

A

O(1+min{i,n-i})

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
5
Q

HashSet: all operations

A

O(1)

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
6
Q

TreeSet: all operations

A

O(logn)

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
7
Q

TreeSet(Sorted): all operations

A

O(logn)

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
8
Q

HashMap: all operations

A

O(1)

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
9
Q

TreeMapp^3: all operations

A

O(logn)

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
10
Q

ArrayDeque: all operations

A

O(1)

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
11
Q

LinkedList(Deque): all operations

A

O(1)

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
12
Q

ArrayDeque(Queue): all operations

A

O(1)

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
13
Q

LinkedList(Queue): all operations

A

O(1)

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
14
Q

PrioityQueue: add(x)

A

O(logn)

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
15
Q

PrioityQueue: remove()

A

O(logn)

16
Q

PrioityQueue: element()

A

O(1)

17
Q

sort(list):

A

O(nlogn)

18
Q

min(c)/max(c):

A

O(n)

19
Q

reverse(list):

A

O(n)

20
Q

binarySearch(list, x):

A

O(logn)