(self, array)
| 52 | return self.heap_dict[key] |
| 53 | |
| 54 | def build_heap(self, array): |
| 55 | last_idx = len(array) - 1 |
| 56 | start_from = self.get_parent_idx(last_idx) |
| 57 | |
| 58 | for idx, i in enumerate(array): |
| 59 | self.idx_of_element[i] = idx |
| 60 | self.heap_dict[i.name] = i.val |
| 61 | |
| 62 | for i in range(start_from, -1, -1): |
| 63 | self.sift_down(i, array) |
| 64 | return array |
| 65 | |
| 66 | # this is min-heapify method |
| 67 | def sift_down(self, idx, array): |
no test coverage detected