(self, i, j)
| 40 | self.heapify(n, largest) |
| 41 | |
| 42 | def swap(self, i, j): |
| 43 | current_i = self.head |
| 44 | current_j = self.head |
| 45 | |
| 46 | for _ in range(i): |
| 47 | current_i = current_i.next |
| 48 | |
| 49 | for _ in range(j): |
| 50 | current_j = current_j.next |
| 51 | |
| 52 | current_i.data, current_j.data = current_j.data, current_i.data |
| 53 | |
| 54 | def heap_sort(self): |
| 55 | n = 0 |