(self, idx)
| 19 | return self.cur_size == 0 |
| 20 | |
| 21 | def min_heapify(self, idx): |
| 22 | lc = self.left(idx) |
| 23 | rc = self.right(idx) |
| 24 | if lc < self.cur_size and self.array(lc)[0] < self.array(idx)[0]: |
| 25 | smallest = lc |
| 26 | else: |
| 27 | smallest = idx |
| 28 | if rc < self.cur_size and self.array(rc)[0] < self.array(smallest)[0]: |
| 29 | smallest = rc |
| 30 | if smallest != idx: |
| 31 | self.swap(idx, smallest) |
| 32 | self.min_heapify(smallest) |
| 33 | |
| 34 | def insert(self, tup): |
| 35 | # Inserts a node into the Priority Queue |
no test coverage detected