inserting an element in the heap
(self, data)
| 35 | return (idx * 2) + 2 |
| 36 | |
| 37 | def insert(self, data): |
| 38 | """ |
| 39 | inserting an element in the heap |
| 40 | """ |
| 41 | # TODO: Fix this if we want this compatible with 2.7 |
| 42 | super().enqueue(data) |
| 43 | if self.rear >= 1: # heap may need to be fixed |
| 44 | self.heapify_up() |
| 45 | |
| 46 | def heapify_up(self): |
| 47 | """ |