liveBook · Manning

Heap

A binary heap is an almost complete binary tree in which each parent obeys an ordering property relative to its children, allowing efficient access to a minimum or maximum element.

How 4 Manning books explain it

Advanced Algorithms and Data Structures

A binary heap is a complete binary-tree-based priority queue in which each node has priority at least as high as every node in its subtree.

How it is used
Implements a priority queue for processing tasks or other elements by priority.
How deep it goes
Develops array invariants, index formulas, repair operations, bottom-up construction, and time–space costs.
Examples
Uses prioritized tasks, tree-to-array diagrams, heapification steps, the k-largest-elements problem, and shortest paths.
What you can do after
Build it from scratch with array indexing, heap-property repair, and bottom-up heapify; evaluate lookup and branching-factor trade-offs.

Read how Advanced Algorithms and Data Structures explains heap →

Grokking Data Structures

A binary heap is a heap represented as a binary, almost complete tree in which each node satisfies the heap ordering property relative to its children.

How it is used
Implements a priority queue that removes the highest-priority item rather than the earliest inserted item.
How deep it goes
Works through tree properties, array storage, insertion, removal, and bottom-up heap construction, without a formal height proof.
Examples
Uses a bug queue and the insertion of a high-priority broken-login report to illustrate bubble-up.
What you can do after
Build it from scratch with a Python list, including insert, top, and linear-time heapify.

Read how Grokking Data Structures explains heap →

Classic Computer Science Problems in Swift: Essential techniques for practicing programmers

A binary heap is a tree-shaped priority-queue implementation that maintains an ordering relationship between parents and children.

How it is used
Uses a priority queue to select the next A* frontier state by lowest estimated total cost.
How deep it goes
Defines heap-backed priority queues and operation costs but defers the heap's internal implementation.
Examples
Demonstrates heap-backed ordering through Swift A* maze searches using node cost and Manhattan distance.
What you can do after
Apply it via SwiftPriorityQueue when implementing A* frontier selection.

Read how Classic Computer Science Problems in Swift: Essential techniques for practicing programmers explains heap →

The Coder Cafe

A binary heap is a complete binary tree that maintains a heap-order property for efficiently retrieving a minimum or maximum element.

How it is used
Supports priority queues and other workloads requiring quick access to the minimum or maximum element.
How deep it goes
Defines tree and array representations, explains heapify operations, and gives operation and construction complexities.
Examples
Uses a max-heap containing 39 at array index 1 to demonstrate child and parent calculations.
What you can do after
Build it from scratch by choosing min- or max-order, storing elements in an array, and implementing core heap operations.

Read how The Coder Cafe explains heap →

Also covered in

What to know first

Related concepts

Questions about heap

What is heap?

A binary heap is an almost complete binary tree in which each parent obeys an ordering property relative to its children, allowing efficient access to a minimum or maximum element.

Which Manning books explain heap?

Advanced Algorithms and Data Structures, Grokking Data Structures, Classic Computer Science Problems in Swift: Essential techniques for practicing programmers and The Coder Cafe.

What should I know before learning heap?

Manning books that teach heap usually introduce priority queue, queue, array and logarithmic time complexity first.

What kinds of heap are there?

Kinds of heap include min-heap and max heap.

What is heap a kind of?

Heap is a kind of binary tree. A binary tree is a tree data structure in which each node has at most two children.

These guides are generated from the text of Manning books by Manning's knowledge graph and link to the sections they draw on. The full books are available on liveBook and at manning.com.