heaps Flashcards

1
Q

what are 4 heap operations

A

-find min/max
-delete min/max
-insert element
-bouiding heap

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

time complexity of find min

A

O(1)

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

insert elemnt time complexity

A

O(log n)

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

dequeue time complexity

A

O(n log n)

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

building heaps code

A

Given an array of numbers fix each element
For (x = (n/2)-1; x >= 0; –x){
Trickle down to restore heap property
}

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