Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Paper - Malakhova K. #54

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open

Conversation

kmalakhova
Copy link

No description provided.

@kmalakhova kmalakhova changed the title Pass the tests Paper - Malakhova K. Jan 16, 2022
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 Kate, you hit the learning goals here. I only left minor feedback.

class Tree:
def __init__(self):
self.root = None

# Time Complexity:
# Space Complexity:
def add_helper(self, current_node, key, value):

Choose a reason for hiding this comment

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

👍 Space/time complexity?

return current_node

# Time Complexity: O(logN)
# Space Complexity: O(logN)
def add(self, key, value = None):

Choose a reason for hiding this comment

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

👍

Comment on lines +41 to 43
# Time Complexity: O(logN)
# Space Complexity: O(logN)
def find(self, key):

Choose a reason for hiding this comment

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

👍 Nice recursive solution

Comment on lines +55 to 57
# Time Complexity: O(N)
# Space Complexity: O(N)
def inorder(self):

Choose a reason for hiding this comment

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

👍

Comment on lines +68 to 70
# Time Complexity: O(N)
# Space Complexity: O(N)
def preorder(self):

Choose a reason for hiding this comment

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

👍

Comment on lines +81 to 83
# Time Complexity: O(N)
# Space Complexity: O(N)
def postorder(self):

Choose a reason for hiding this comment

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

👍

Comment on lines +93 to 95
# Time Complexity: O(logN)
# Space Complexity: O(logN)
def height(self):

Choose a reason for hiding this comment

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

👍 However the time complexity is O(n) because you visit each node.

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