Skip to content

Conversation

@Faiza1987
Copy link

No description provided.

Copy link

@CheezItMan CheezItMan left a 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.

@root = nil
end

# Time Complexity:

Choose a reason for hiding this comment

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

Time and space complexity?

# Space Complexity:
def height
raise NotImplementedError
def height(current = @root, array)

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.

# Space Complexity:
def bfs
raise NotImplementedError
def bfs(current = @root, array = [])

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.

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