Heap Flashcards

1
Q

how would you implement binary heap? Basic functions?

A

using dynamic array implementation; heapifyUp, heapifyDown, insert, resize

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

what is called function to sort binary heap?

A

heapifyMax / heapifyDown

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

how would you sort elements in binary heap?

A

I would find max and swap it with the last one and at the end decrease size by one and next heapifyDown to new size

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