Skip to content

Conversation

@idago123
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 Ida, you hit the learning goals here. Well done.

Comment on lines +19 to +21
# Time Complexity: o(n) or (log n)?
# Space Complexity: o(n)
def add(key, value = '')

Choose a reason for hiding this comment

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

👍 This works, the time complexity and space complexity are O(log n) if the tree is balanced and O(n) if it's not.

Comment on lines +47 to 49
# Time Complexity: o(n) or (log n)?
# Space Complexity: o(n)
def find(key)

Choose a reason for hiding this comment

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

👍 See the add method for time/space complexity.

Comment on lines +67 to 69
# 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 +83 to 85
# 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 +99 to 101
# 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 +115 to +117
# Time Complexity: O(n)
# Space Complexity: o(n)
def height # somewhere between log_2(N+1) and N

Choose a reason for hiding this comment

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

👍

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