@@ -512,7 +512,7 @@ def svg(self, node_radius: int = 16) -> str:
512512
513513 def scale_x (x : int , y : int ) -> float :
514514 diff = tree_height - y
515- x = 2 ** (diff + 1 ) * x + 2 ** diff - 1
515+ x = 2 ** (diff + 1 ) * x + 2 ** diff - 1
516516 return 1 + node_radius + scale * x / 2
517517
518518 def scale_y (y : int ) -> float :
@@ -562,7 +562,7 @@ def add_node(node_x: int, node_y: int, node_value: NodeValue) -> None:
562562 y += 1
563563
564564 return _SVG_XML_TEMPLATE .format (
565- width = scale * (2 ** tree_height ),
565+ width = scale * (2 ** tree_height ),
566566 height = scale * (2 + tree_height ),
567567 body = "\n " .join (xml ),
568568 )
@@ -1833,7 +1833,7 @@ def _generate_random_leaf_count(height: int) -> int:
18331833 :return: Random leaf count.
18341834 :rtype: int
18351835 """
1836- max_leaf_count = 2 ** height
1836+ max_leaf_count = 2 ** height
18371837 half_leaf_count = max_leaf_count // 2
18381838
18391839 # A very naive way of mimicking normal distribution
@@ -2016,7 +2016,7 @@ def _get_tree_properties(root: Node) -> NodeProperties:
20162016 size = size ,
20172017 is_max_heap = is_complete and is_descending ,
20182018 is_min_heap = is_complete and is_ascending ,
2019- is_perfect = leaf_count == 2 ** max_leaf_depth ,
2019+ is_perfect = leaf_count == 2 ** max_leaf_depth ,
20202020 is_strict = is_strict ,
20212021 is_complete = is_complete ,
20222022 leaf_count = leaf_count ,
@@ -2486,7 +2486,7 @@ def heap(
24862486
24872487 if not is_perfect :
24882488 # Randomly cut some of the leaf nodes away
2489- random_cut = random .randint (2 ** height , len (values ))
2489+ random_cut = random .randint (2 ** height , len (values ))
24902490 values = values [:random_cut ]
24912491
24922492 if is_max :
0 commit comments