Heap Flashcards
1
Q
how would you implement binary heap? Basic functions?
A
using dynamic array implementation; heapifyUp, heapifyDown, insert, resize
2
Q
what is called function to sort binary heap?
A
heapifyMax / heapifyDown
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