Heap operations
Not all implementations of the heap data structures expose the same operational methods. However, the more common operations should be available or made available as needed by the developer.
Insert: The Insert operation adds a new node to the heap. This operation must also re-order the heap to ensure that the newly added node maintains the heap property. This operation has an O(log n) operational cost.
FindMax: The FindMax operation is synonymous with a max heap, and returns the largest value or highest-priority object in the collection. In an array-based implementation, this is typically the object at either index 0 or index 1, depending on the design. This is equivalent to the peek operation in a stack or queue, which is important when using a heap to implement a priority queue. This operation has an O(1) operational cost.
FindMin: The FindMin operation is related to a min heap, and returns the smallest value or lowest-priority object in the collection. In an array-based implementation...