-
Notifications
You must be signed in to change notification settings - Fork 43
Leaves - Hallie Johnson #24
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
base: master
Are you sure you want to change the base?
Conversation
CheezItMan
left a comment
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.
Nice work, you hit the basic learning goals, with some issues on space/time complexity. Check out my comments and let me know if you have any questions.
| # Time Complexity: O(log n) | ||
| # Space Complexity: O(log n) | ||
| def add(key, value) |
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: Best: O(log n), Worst: O(n) | ||
| # Space Complexity: O(n) |
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.
Both space/time complexity are O(log n) for a balanced tree and O(n) for an unbalanced tree.
| # Time Complexity: O(n) | ||
| # Space Complexity: O(n) | ||
| def inorder_helper(current_node, list) |
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: O(n) | ||
| # Space Complexity: O(n) | ||
| def preorder_helper(current_node, list) |
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.
👍
| return list | ||
| end | ||
|
|
||
| def postorder |
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: O(n) | ||
| # Space Complexity:O(n) | ||
| def height_helper(current_node) |
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.
👍 Nice work, the space complexity however is O(log n) for a balanced tree and O(n) for an unbalanced tree.
No description provided.