Conversation
CheezItMan
left a comment
There was a problem hiding this comment.
Well done Lin, you hit the learning goals here. Well done. I did leave some minor comments. Take a look and let me know what questions you have.
| # Time Complexity: O(log(n))*assumes all balanced tree | ||
| # Space Complexity: O(1) | ||
| def add(self, key, value=None): |
There was a problem hiding this comment.
👍 However due to the recursive call stack this is O(log n) for space complexity (if the tree is balanced and O(n) otherwise).
| # Time Complexity: O(log(n)) | ||
| # Space Complexity: O(1) | ||
| def find(self, value): |
There was a problem hiding this comment.
👍 Similar issues with space complexity.
| # Time Complexity: O(logn) | ||
| # Space Complexity: O(n) | ||
| def inorder(self): |
There was a problem hiding this comment.
👍 Since you hit each node and make a list the of all the nodes in the tree the time and space complexity is O(n)
| # Time Complexity: O(logn) | ||
| # Space Complexity: O(n) | ||
| def preorder(self): |
There was a problem hiding this comment.
👍 Similar issues to time/space complexity
| # Time Complexity: O(logn) | ||
| # Space Complexity: O(n) | ||
| def postorder(self): |
There was a problem hiding this comment.
👍 Similar issues to time/space complexity
| # Time Complexity: O(logn) | ||
| # Space Complexity: O(1) | ||
| def height(self): |
There was a problem hiding this comment.
👍 However the space complexity is O(log n) due to the recursive call stack.
No description provided.