Heap
In plain terms
A tree-based structure that always gives quick access to the highest or lowest item.
Going deeper
A binary heap keeps its top element (max or min) instantly available and rebalances in logarithmic time on insert or removal. It's the engine behind priority queues and efficient scheduling.
Under the hood
A complete binary tree usually stored in an array; insert and extract are O(log n) while peek is O(1). Don't confuse it with the heap memory region.
Examples
Priority queues, Dijkstra's algorithm, heapsort, OS task scheduling, finding top-k elements.
Think of it like...
Like a hospital triage system: the most urgent patient always rises to the top for the next slot, no matter when they arrived.