Skip to content

Conversation

@codeandmorecode
Copy link

No description provided.

Copy link

@CheezItMan CheezItMan left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice work Alice, you hit the main learning goals, well done.

Comment on lines +19 to +21
# Time Complexity: O(log n); although if the tree is not balanced, this could be O(n)
# Space Complexity: O(1)
def add(key, value = nil)

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👍 Correct time complexity given the assumptions

Comment on lines +52 to 54
# Time Complexity: O(log n); although if the tree is not balanced, this could be O(n)
# Space Complexity:
def find(key)

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👍 Correct time complexity given the assumptions

space complexity ???

Comment on lines +68 to 70
# Time Complexity: O(n)
# Space Complexity: O(n)
def inorder

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👍

Comment on lines +88 to 90
# Time Complexity: O(n)
# Space Complexity: O(n)
def preorder

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👍

Comment on lines +107 to 109
# Time Complexity: O(n)
# Space Complexity: O(n)
def postorder

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👍

Comment on lines +127 to 129
# Time Complexity: O(log n); although if the tree is not balanced, this could be O(n)
# Space Complexity: O(1)
def height

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👍 the time complexity is O(n) and space complexity is O(log n) if the tree is balanced and O(n) otherwise.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants