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

C15 Paper Saejin Tanguay #48

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

Conversation

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

Comment on lines +15 to 17
# Time Complexity: On
# Space Complexity: O1
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.

👍 However space complexity is O(log n) if the tree is balanced and O(n) otherwise due to the recursive call stack.

Comment on lines +33 to 35
# Time Complexity: On
# Space Complexity: O1
def find(self, key):

Choose a reason for hiding this comment

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

👍 However space complexity is O(log n) if the tree is balanced and O(n) otherwise due to the recursive call stack.

Comment on lines +51 to 53
# Time Complexity: On
# Space Complexity: On
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: On
# Space Complexity: On
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 +87 to 89
# Time Complexity: On
# Space Complexity: On
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 +107 to 109
# # Time Complexity: On
# # Space Complexity: O1
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 space complexity is O(log n ) for a balanced tree and O(n) for an unbalanced tree.

This is due to the recursive call stack.

Comment on lines +122 to 124
# # Time Complexity: On
# # Space Complexity: On
def bfs(self):

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