Search⌘ K

Heaps

Learn how heaps function as binary trees where parents are larger than children, and discover how C++ standard algorithms like make_heap, push_heap, pop_heap, and sort_heap help manage and sort data efficiently. Understand how to verify heap properties with is_heap and is_heap_until, and how to apply sorting criteria safely.

We'll cover the following...

ℹ️ What is a heap?
A heap is a binary search tree in which parent elements are always bigger than their child elements. Heap trees are optimized for the efficient sorting of elements.

We can create a max heap with std::make_heap. With std::push_heap, we can push new elements on the heap. Conversely, we can ...