What is a Binary Heap?

What is a Binary Heap?

Approach: Define a complete binary tree that satisfies the heap property.

A complete binary tree where every node is less than or equal to its children (Min-Heap) or greater than or equal to its children (Max-Heap). It is typically implemented using an array.

Follow-up: What is the time complexity of extracting the minimum element?

Key concepts: min-heap, max-heap, priority queue.