Heap¶
Interface¶
Implementation of the heap with list.
- class MaxHeap(MAXSIZE: int = 10)¶
- __init__(MAXSIZE: int = 10) None¶
Initialize an MaxHeap.
- insert(item: int) None¶
The Time complexity of the insertion is \(O(\log N)\)
- Parameters:
item – The item to be inserted into the heap.
- delete() int¶
Delete the root element from the heap.
- Returns:
The deleteted element.
- makeheap_from_list(l: list) None¶
Make heap from list. It’s more quickly than insert.