heaps Flashcards
1
Q
what are 4 heap operations
A
-find min/max
-delete min/max
-insert element
-bouiding heap
2
Q
time complexity of find min
A
O(1)
3
Q
insert elemnt time complexity
A
O(log n)
4
Q
dequeue time complexity
A
O(n log n)
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
}