Heaps Flashcards
1
Q
What is a heap?
A
special binary tree, where each node has a value that is equal or lower value than the parent.
The root always contains the highest priority.
No horizontal relationship between nodes.
2
Q
Min Heap vs Max Heap
A
A min-heap sorts values from smallest to largest. The root node will always have the smallest value in the heap.
A max-heap sorts values from largest to smallest. The root node will always have the largest value in the heap.