Please enable JavaScript.
Coggle requires JavaScript to display documents.
Heaps and Heapsort, Heapsort - Coggle Diagram
Heaps and Heapsort
Heaps
a clever, partially ordered data structure that is especially suitable for implementing priority queues
priority queues
finding an item with the highest (i.e., largest) priority
-
-
can be defined as a binary tree with keys assigned to its
nodes, one key per node
-
Important properties
There exists exactly one essentially complete binary tree with n nodes. Its height is equal to ⌊log2 n⌋
-
-
A heap can be implemented as an array by recording its elements in the top-down, left-to-right fashion
-
While the ideas behind the majority of algorithms dealing with heaps are easier to understand if we think of heaps as binary trees, their actual implementations are usually much simpler and more efficient with arrays
-