-
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
Heather #13
base: master
Are you sure you want to change the base?
Heather #13
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.
Nice work, you got the major parts here. I like how you used the TreeNode
class to do the operations and the Tree
class just wrapped it. Well done!
def height(tree_height) | ||
# left_height = 0 | ||
# right_heigt = 0 | ||
# if !left.nil? |
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.
I would say
unless left.nil?
left_height = left.height + 1
end
You can do the same with right, and then return the larger of left and right's heights plus 1.
# Time Complexity: | ||
# Space Complexity: | ||
# Time Complexity: | ||
# Space Complexity: | ||
def bfs |
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'll have a tool to help with this on Thursday. Look for it.
:p
No description provided.