@@ -67,7 +67,9 @@ def right_rotation(node: MyNode) -> MyNode:
6767 node .set_left (ret .get_right ())
6868 ret .set_right (node )
6969
70- node .set_height (my_max (get_height (node .get_left ()), get_height (node .get_right ())) + 1 )
70+ node .set_height (
71+ my_max (get_height (node .get_left ()), get_height (node .get_right ())) + 1
72+ )
7173 ret .set_height (my_max (get_height (ret .get_left ()), get_height (ret .get_right ())) + 1 )
7274
7375 return ret
@@ -79,7 +81,9 @@ def left_rotation(node: MyNode) -> MyNode:
7981 node .set_right (ret .get_left ())
8082 ret .set_left (node )
8183
82- node .set_height (my_max (get_height (node .get_left ()), get_height (node .get_right ())) + 1 )
84+ node .set_height (
85+ my_max (get_height (node .get_left ()), get_height (node .get_right ())) + 1
86+ )
8387 ret .set_height (my_max (get_height (ret .get_left ()), get_height (ret .get_right ())) + 1 )
8488
8589 return ret
@@ -119,7 +123,9 @@ def insert_node(node: MyNode | None, data: Any) -> MyNode:
119123 else :
120124 node = left_rotation (node )
121125
122- node .set_height (my_max (get_height (node .get_left ()), get_height (node .get_right ())) + 1 )
126+ node .set_height (
127+ my_max (get_height (node .get_left ()), get_height (node .get_right ())) + 1
128+ )
123129 return node
124130
125131
@@ -136,6 +142,7 @@ def get_height(self) -> int:
136142
137143# ✅ NEW FEATURE (YOUR CONTRIBUTION)
138144
145+
139146def inorder_traversal (root , result ):
140147 """
141148 Performs inorder traversal of AVL tree and stores result.
@@ -162,4 +169,4 @@ def avl_sort(arr):
162169 result = []
163170 inorder_traversal (tree .root , result )
164171
165- return result
172+ return result
0 commit comments