pytudes._2021.utils.heap
https://www.educative.io/courses/grokking-the-coding-interview/3Yj2BmpyEy4
- See Also:
pytudes/_2021/educative/grokking_the_coding_interview/two_heaps/_1__find_the_median_of_a_number_stream__medium.py
Module Contents
Classes
MinHeap with negated numbers |
|
heapq-based interface |
- class pytudes._2021.utils.heap.MaxHeap[source]
Bases:
MinHeap
MinHeap with negated numbers
- Examples:
>>> heap = MaxHeap() >>> heap.push(1) >>> heap.push(2) >>> heap.push(3) >>> heap.peek() 3 >>> heap.pop() 3 >>> heap.pop() 2 >>> heap.pop() 1