Skip to content

Commit f71d620

Browse files
committed
chore(heaps): max heap data comparision
1 parent f507b4e commit f71d620

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

datastructures/trees/heaps/binary/max_heap/max_heap.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -107,7 +107,7 @@ def decrease_value_at(self, index, new_val):
107107
It is assumed that new_val is smaller than heap[i]
108108
"""
109109
self.heap[index] = new_val
110-
while index != 0 and self.heap[self.get_parent_index(index)] > self.heap[index]:
110+
while index != 0 and self.heap[self.get_parent_index(index)].data > self.heap[index].data:
111111
# Swap heap[i] with heap[parent(i)]
112112
self.heap[index], self.heap[self.get_parent_index(index)] = (
113113
self.heap[self.get_parent_index(index)],

0 commit comments

Comments
 (0)