Skip to content

Conversation

@ktiktok96
Copy link

Binary Search Tree w/ time/space complexity

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

Comment on lines +17 to +20
# Time Complexity: O(log n)
# Space Complexity: O(log n )

def add_helper(self, current, key, value):

Choose a reason for hiding this comment

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

👍 Time/space complexity is correct if the tree is balanced. O(n) otherwise.

Comment on lines +36 to 38
# Time Complexity: O( log n )
# Space Complexity: O (log 1 )
def find(self, key):

Choose a reason for hiding this comment

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

👍

Comment on lines +61 to +63
# Time Complexity: O(n)
# Space Complexity: O(n)
def preorder_helper(self, current_node, listofvalues):

Choose a reason for hiding this comment

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

👍

Comment on lines +76 to +78
# Time Complexity: O(n)
# Space Complexity: O(n)
def postorder_helper(self, current_node, listofvalues):

Choose a reason for hiding this comment

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

👍

Comment on lines +89 to +91
# Time Complexity: O(n)
# Space Complexity: O(log n)
def height_helper(self, current_node):

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