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

Whit - Paper #39

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

Whit - Paper #39

wants to merge 1 commit into from

Conversation

sundbean
Copy link

No description provided.

@sundbean sundbean changed the title Project complete, including optional Whit Nov 28, 2021
@sundbean sundbean changed the title Whit Whit - Paper Nov 28, 2021
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.

Well done Whit, you hit the learning goals and more with BFS. Nice work. I left a little feedback on space complexity due to the recursive stack.

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

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 the space complexity is O(log n) due to the recursive stack


# Time Complexity:
# Space Complexity:
def add_iterative(self, key, value = None):

Choose a reason for hiding this comment

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

Nice iterative solution

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

👍 However the space complexity is O(log n)

Comment on lines +94 to 96
# 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 +114 to 116
# 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 +150 to 152
# 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 +168 to 170
# Time Complexity: O(n)
# Space Complexity: O(1)
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.

Comment on lines +186 to 188
# # Time Complexity: O(n)
# # Space Complexity: O(n)
def bfs(self):

Choose a reason for hiding this comment

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

Nice BFS solution!

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