Skip to content

Space - Jeta#31

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

Space - Jeta#31
jetabajrami wants to merge 1 commit into
Ada-C13:masterfrom
jetabajrami:master

Conversation

@jetabajrami

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.

Overall well done, 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: 0(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.

👍 , the time complexity is O(log n) if the tree is balanced.

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

👍 , the time complexity is O(log n) if the tree is balanced.

Comment thread lib/tree.rb
Comment on lines +67 to 69
# Time Complexity: 0(n)
# Space Complexity: 0(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: 0(n)
# Space Complexity: 0(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 +110 to 112
# Time Complexity: 0(n)
# Space Complexity: 0(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 +132 to 134
# Time Complexity: 0(n)
# Space Complexity: 0(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 is O(n) if the tree is unbalanced. O(log n) if it is balanced.

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