-
Notifications
You must be signed in to change notification settings - Fork 69
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
BTS 16/18 #62
base: master
Are you sure you want to change the base?
BTS 16/18 #62
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
✨🌸 Really nice implementation, Nicole. Because the time and space complexity is missing, I am marking this as a yellow. Let me know what questions you have.
🟡
# Time Complexity: | ||
# Space Complexity: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
⏱🪐 Time and space complexity?
# Time Complexity: | ||
# Space Complexity: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
⏱🪐 Time and space complexity?
|
||
# Time Complexity: | ||
# Space Complexity: | ||
def find(self, key): |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
✨
# Space Complexity: | ||
# Space Complexity: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
⏱🪐 Time and space complexity?
|
||
# Time Complexity: | ||
# Space Complexity: | ||
# Space Complexity: | ||
def inorder(self): |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
✨
# append key value pairs as backtrack up the stack | ||
inorder_result.append({'key': current_node.key, 'value': current_node.value}) | ||
# traverse right | ||
self.inorder_helper(current_node.right, inorder_result) | ||
|
||
# Time Complexity: | ||
# Space Complexity: | ||
def preorder(self): |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
✨
# Time Complexity: | ||
# Space Complexity: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
⏱🪐 Time and space complexity?
preorder_result.append({'key': curr_node.key, 'value': curr_node.value}) | ||
self.preorder_helper(curr_node.left, preorder_result) | ||
self.preorder_helper(curr_node.right, preorder_result) | ||
|
||
|
||
# Time Complexity: | ||
# Space Complexity: | ||
def postorder(self): |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
✨
if curr_node is None: | ||
return 0 | ||
return 1 + max(self.height_helper(curr_node.left), self.height_helper(curr_node.right)) | ||
|
||
|
||
# Time Complexity: | ||
# Space Complexity: | ||
def height(self): |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
✨
# Time Complexity: | ||
# Space Complexity: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
⏱🪐 Time and space complexity?
No description provided.