Skip to content

Commit 2d1c7e7

Browse files
committed
fix division bug
Need to have float number at one side for correct division
1 parent f85ef4b commit 2d1c7e7

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

heaps/minheap.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ def height(self):
2323

2424
def is_leaf(self, i):
2525
""" returns True if i is a leaf node """
26-
return i > int(math.ceil( (len(self.heap)- 2) / 2))
26+
return i > int(math.ceil((len(self.heap) - 2) / 2.0))
2727

2828
def parent(self, i):
2929
if i == 0:

0 commit comments

Comments
 (0)