I am genuinely confused what I did wrong, does it want me to assign the return value of the helper function to a variable?
These are the instructions:
Within the inorder_traversal
method, start the in-order traversal by calling the helper method _inorder_traversal
and pass the BST root and the result
list as the arguments.
This will start the traversal from the root of the binary search tree (self.root
), and the result
list will be passed to accumulate the keys during the traversal.
def inorder_traversal(self):
result = []
_inorder_traversal(self.root, result)