Skip to content

Commit

Permalink
Fix bug when the leaf is not at the bottom
Browse files Browse the repository at this point in the history
  • Loading branch information
kcalvinalvin committed Aug 26, 2024
1 parent f3bd97b commit a4e4f6b
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion pytreexo.py
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,7 @@ def root_idx(numleaves: int, position: int) -> int:
if not root_present(numleaves, row):
continue
pos = position
for _ in range(row): pos = parent(pos, tree_rows(numleaves))
for _ in range(detect_row(position, tree_rows(numleaves)), row): pos = parent(pos, tree_rows(numleaves))
if isroot(pos, numleaves, tree_rows(numleaves)):
return idx
idx += 1
Expand Down

0 comments on commit a4e4f6b

Please sign in to comment.