liveBook · Manning

Heap

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

How 3 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 →

Related concepts

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.