Skip to content

Fire - Alice D - #20

Open
codeandmorecode wants to merge 7 commits into
Ada-C14:masterfrom
codeandmorecode:master
Open

Fire - Alice D#20
codeandmorecode wants to merge 7 commits into
Ada-C14:masterfrom
codeandmorecode:master

Conversation

@codeandmorecode

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.

Nice work Alice, you hit the main learning goals, well done.

Comment thread lib/tree.rb
Comment on lines +19 to +21
# Time Complexity: O(log n); although if the tree is not balanced, this could be O(n)
# Space Complexity: O(1)
def add(key, value = nil)

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

👍 Correct time complexity given the assumptions

Comment thread lib/tree.rb
Comment on lines +52 to 54
# Time Complexity: O(log n); although if the tree is not balanced, this could be O(n)
# Space Complexity:
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.

👍 Correct time complexity given the assumptions

space complexity ???

Comment thread lib/tree.rb
Comment on lines +68 to 70
# 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 +88 to 90
# 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 +107 to 109
# 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 +127 to 129
# Time Complexity: O(log n); although if the tree is not balanced, this could be O(n)
# Space Complexity: O(1)
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 time complexity is O(n) and space complexity is O(log n) if the tree is balanced and O(n) otherwise.

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