Skip to content
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

Height of a Binary Tree #2524

Closed
bhargav41 opened this issue Oct 7, 2021 · 4 comments
Closed

Height of a Binary Tree #2524

bhargav41 opened this issue Oct 7, 2021 · 4 comments
Assignees
Labels

Comments

@bhargav41
Copy link

Problem Statement :- To find the height of the binary tree. The height of a binary tree is the number of edges between the tree's root and its furthest leaf.

Input: :- The first line contains an integer n, the number of nodes in the tree.
Next line contains n space separated integer where ith integer denotes node[i].data.

Example:-
ss

Input:-
7
3 5 2 1 4 6 7

Output:-
3

Approach:-
We can use a recursive function , of type integer ,with base condition being to return 0 when the current node is leaf node. Else we will call the function recursively to the left , then the right and at the end return the MAX of left subtree and right subtree and add 1 to it.

@bhargav41
Copy link
Author

please assign this issue to me

@spao234
Copy link

spao234 commented Oct 15, 2021

Please assign this issue to me

@github-actions
Copy link

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

@github-actions github-actions bot added the stale label Nov 25, 2021
@github-actions
Copy link

github-actions bot commented Dec 2, 2021

Please reopen this issue once you add more information and updates here. If this is not the case and you need some help, feel free to seek help from our Gitter or ping one of the reviewers. Thank you for your contributions!

@github-actions github-actions bot closed this as completed Dec 2, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants