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

Leaves_Ga-Young #48

Open
wants to merge 4 commits into
base: master
Choose a base branch
from
Open

Leaves_Ga-Young #48

wants to merge 4 commits into from

Conversation

gyjin
Copy link

@gyjin gyjin commented Mar 13, 2020

I originally forked this project from Ada-C11/tree-practice, and when I tried to go back to forking from Ada-C12/tree-practice instead, GitHub kept redirecting me to the already forked tree-practice repo from C11. Not sure why that happened or how to fix it, but I hope this is similar enough to the correct assignment.

CheezItMan and others added 4 commits August 20, 2019 22:31
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.

Overall not bad. Take a look at my comments, mostly on BigO, and let me know any questions you have. Otherwise well done.

Comment on lines +30 to 32
# Time Complexity: O(log n) where n is number of nodes ?
# Space Complexity: O(n) where n is number of nodes ?
def add(key, value)

Choose a reason for hiding this comment

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

Since you're not add n nodes to the tree the space complexity is O(1).

Comment on lines +66 to 68
# Time Complexity: O(log n) where n is number of nodes ?
# Space Complexity: O(1) or is this N/A?
def find(key)

Choose a reason for hiding this comment

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

👍

Comment on lines +96 to 98
# Time Complexity: O(n) where n is number of nodes
# Space Complexity: O(n) where n is number of nodes
def inorder

Choose a reason for hiding this comment

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

👍

Comment on lines +111 to 113
# Time Complexity: O(n) where n is number of nodes
# Space Complexity: O(n) where n is number of nodes
def preorder

Choose a reason for hiding this comment

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

👍

Comment on lines +126 to 128
# Time Complexity: O(n) where n is number of nodes
# Space Complexity: O(n) where n is number of nodes
def postorder

Choose a reason for hiding this comment

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

👍

Comment on lines +143 to 145
# Time Complexity: O(n) where n is number of nodes
# Space Complexity: O(1)
def height

Choose a reason for hiding this comment

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

Since height_helper is recursive, this is O(log n) for space complexity. Since you'll have log n recursive calls on the stack at any one time.

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.

3 participants