MCPcopy Create free account
hub / github.com/geekcomputers/Python / swap

Method swap

Sorting Algorithims/heapsort_linkedlist.py:42–52  ·  view source on GitHub ↗
(self, i, j)

Source from the content-addressed store, hash-verified

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

Callers 2

heapifyMethod · 0.95
heap_sortMethod · 0.95

Calls

no outgoing calls

Tested by

no test coverage detected