Skip to content

Conversation

@idhallie
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, 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.

Comment on lines +31 to 33
# Time Complexity: O(log n)
# Space Complexity: O(log 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.

👍

Comment on lines +43 to +44
# Time Complexity: Best: O(log n), Worst: O(n)
# Space Complexity: O(n)

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.

Comment on lines +68 to +70
# Time Complexity: O(n)
# Space Complexity: O(n)
def inorder_helper(current_node, list)

Choose a reason for hiding this comment

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

👍

Comment on lines +85 to +87
# Time Complexity: O(n)
# Space Complexity: O(n)
def preorder_helper(current_node, list)

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

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)

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.

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