(self, elem: T, weight: int)
| 99 | return self.elements == 0 |
| 100 | |
| 101 | def push(self, elem: T, weight: int) -> None: |
| 102 | # Add an element with given priority to the queue |
| 103 | self.heap.append((elem, weight)) |
| 104 | self.position_map[elem] = self.elements |
| 105 | self.elements += 1 |
| 106 | self._bubble_up(elem) |
| 107 | |
| 108 | def extract_min(self) -> T: |
| 109 | # Remove and return the element with lowest weight (highest priority) |
no test coverage detected