Fixes the heap in upward direction of given index
(self, index: int)
| 63 | return valid_parent |
| 64 | |
| 65 | def _heapify_up(self, index: int) -> None: |
| 66 | """Fixes the heap in upward direction of given index""" |
| 67 | parent = self._parent(index) |
| 68 | while parent is not None and not self._cmp(index, parent): |
| 69 | self._swap(index, parent) |
| 70 | index, parent = parent, self._parent(parent) |
| 71 | |
| 72 | def _heapify_down(self, index: int) -> None: |
| 73 | """Fixes the heap in downward direction of given index""" |
no test coverage detected