runtimes Flashcards

1
Q

BST min and max height

A

min: lower of log base 2 of N
max: N-1

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

perfect BST height

A

lower of log base 2 of N

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

BST search: best and worst

A

best: O(logN)
worst: (lower of logN) + 1

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

BST insert: best and worst

A

best: O(logN)
worst: O(N)

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

BST remove: best and worst

A

best: O(logN)
worst: O(N)

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

enqueue

A

O(logN)

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

dequeue

A

O(logN)

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

peek

A

O(1)

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

isEmpty

A

O(1)

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

getLength

A

O(1)

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

what is the complexity of removing a root node in a max heap

A

O(logN)

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

heap insert and delete

A

O(logN) because height of heap is O(logN)

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