Skip to content

Time - Yesenia#39

Open
yesentorres wants to merge 1 commit into
Ada-C13:masterfrom
yesentorres:master
Open

Time - Yesenia#39
yesentorres wants to merge 1 commit into
Ada-C13:masterfrom
yesentorres:master

Conversation

@yesentorres

Copy link
Copy Markdown

No description provided.

@CheezItMan CheezItMan left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Nicely done Yesenia, you hit the learning goals here. Nice work!

Comment thread lib/tree.rb
Comment on lines +19 to 21
# Time Complexity: O(log n)
# Space Complexity: O(log n)
def add(key, value)

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

👍

Comment thread lib/tree.rb

# Time Complexity:
# Space Complexity:
def add_helper(current, new_node)

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Nice helper method.

Comment thread lib/tree.rb
Comment on lines +43 to 45
# Time Complexity: O(log n)
# Space Complexity: O(log n)
def find(key)

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

👍 , however since you're doing this with a loop instead of recursively you have a space complexity of O(1)

Comment thread lib/tree.rb
Comment on lines +63 to 65
# Time Complexity: O(n)
# Space Complexity: O(n)
def inorder

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

👍

Comment thread lib/tree.rb
Comment on lines +82 to 84
# Time Complexity: O(n)
# Space Complexity: O(n)
def preorder

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

👍

Comment thread lib/tree.rb
Comment on lines +101 to 103
# Time Complexity: O(n)
# Space Complexity: O(n)
def postorder

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

👍

Comment thread lib/tree.rb
Comment on lines +120 to 122
# Time Complexity: O(n)
# Space Complexity: O(log n) - balanced
def height

Copy link
Copy Markdown

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