extractmax
Extractmax is an operation on a max-priority queue or max-heap that removes and returns the element with the highest key. The element to be returned is the maximum in the data structure, and the operation maintains the remaining structure in a valid max-heap or priority queue.
In a binary max-heap implementation, the maximum element is stored at the root. To extract it, the
Other heap variants and advanced structures handle extractmax differently. For example, in a Fibonacci heap, removing
Related operations include insert (to add a new element) and peek or maximum (to view the current