Skip to content

Time - Denisse#18

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

Time - Denisse#18
denisseai wants to merge 1 commit into
Ada-C13:masterfrom
denisseai:master

Conversation

@denisseai

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.

Well done Denisse. This is excellent work, very compact and well written.

Comment thread lib/tree.rb
Comment on lines +19 to 21
# Time Complexity: O(log n)
# Space Complexity: O(1)
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
Comment on lines +40 to 42
# 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.

👍 , well done here, very compact.

Comment thread lib/tree.rb
Comment on lines +58 to 60
# 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 +74 to 76
# 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 +89 to 91
# 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 +105 to 107
# Time Complexity: O(n)
# Space Complexity: O(n)
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.

The space complexity would be O(h), where h is the height of the tree, due to the call stack.

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