Conversation
CheezItMan
left a comment
There was a problem hiding this comment.
Very well done. Take a look at my minor comments, but otherwise excellent work.
| # Time Complexity: O(n) | ||
| # Space Complexity: O(1) | ||
| def add_help(current, new_node) |
There was a problem hiding this comment.
👍 However since you are using recursion the space complexity is O(log n) if the tree is balanced (time as well) and O(n) if the tree is unbalanced.
| # Time Complexity: log(n) | ||
| # Space Complexity: O(1) | ||
| def help_find(current, key) |
There was a problem hiding this comment.
👍 However since you are using recursion the space complexity is O(log n) if the tree is balanced (time as well) and O(n) if the tree is unbalanced.
| # Time Complexity: O(n) | ||
| # Space Complexity: O(1) | ||
| def help_inorder(current) |
There was a problem hiding this comment.
👍 However since you are using recursion the space complexity is O(log n) if the tree is balanced and O(n) if the tree is unbalanced.
| # Time Complexity: log(n) | ||
| # Space Complexity: O(1) | ||
| def help_preorder(current) |
There was a problem hiding this comment.
👍 However since you are using recursion the space complexity is O(log n) if the tree is balanced and O(n) if the tree is unbalanced.
| # Time Complexity: log(n) | ||
| # Space Complexity: O(1) | ||
| def help_postorder(current) |
There was a problem hiding this comment.
👍 However since you are using recursion the space complexity is O(log n) if the tree is balanced and O(n) if the tree is unbalanced.
| return 0 if current.nil? | ||
| left += height_helper(current.left) | ||
| right += height_helper(current.right) | ||
| num += 1 |
There was a problem hiding this comment.
Why not just set num to 1 in line 104?
No description provided.