vimwiki/tech/Heap.wiki
2022-09-12 16:49:14 -04:00

24 lines
698 B
Plaintext

= Heap =
A heap is a specialized data structure that is often represented as a tree. It
fundamentally, however, is a set of data that satisfied the *heap property*.
A heap is the most efficent implmentation of the [[priority_queue|Priority Queue]].
A heap is not really a sorted structure, it is a structure that specializes in
repeated insertion/removal with access to the largest/smalled value in said
set.
Although a heap can be implemented in many ways, they never exceed O(log n) for
any operation, and therefore are very perfomant.
== Heap Property ==
The heap property states that
* For a min heap
* Key,,child,, >= Key,,parent,,
* For a max heap
* Key,,parent,, >= Key,,child,,