-
Notifications
You must be signed in to change notification settings - Fork 44
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
Faiza A. #17
base: master
Are you sure you want to change the base?
Faiza A. #17
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You got almost everything done. However you didn't list the Big-O of each method and you didn't get height done. Otherwise nice work!
Take a look at my comments and let me know what questions you have.
@@ -18,45 +18,101 @@ def initialize | |||
|
|||
# Time Complexity: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Time and space complexity?
end | ||
|
||
# Time Complexity: | ||
# Space Complexity: | ||
def height | ||
raise NotImplementedError | ||
def height(current = @root, array) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The height of a tree at any node will be the max height of the left subtree compared to the right subtree plus one.
Does that help?
Remember if a current
is nil the height is 0.
end | ||
|
||
# Optional Method | ||
# Time Complexity: | ||
# Space Complexity: | ||
def bfs | ||
raise NotImplementedError | ||
def bfs(current = @root, array = []) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
For this you'll need a Queue, which we'll talk about in class a bit.
No description provided.