### height

#### Java Binary Tree Height

```How would I go about solving this question? I'm pretty sure that the height of this tree is 3... Please correct me if I'm wrong! Thanks!
```
```What the question asks is, How many combinations are there to insert elements to the binary tree in order to obtain the maximum height of the binary tree
Suppose if we insert elements to the tree in the reverse sorted manner. First 5, then 4 and finally 1. In this case, each element will be added to the right of the parent making a tree of height 5.
Suppose if we insert elements in sorted order. Then each element will be added to the left of it's parent which also make the tree of height 5.
In both of the above cases, child nodes were added only to left side or right side of a parent
In all the other combinations, since there can be at least one element with two children, the height of the tree will not exceed 4.
Therefore, the answer for the question is 2 since there is only two combinations to achieve the maximum height, 5. The height of the tree will be 3 only when the tree is balanced.
Hope you found the solution.```

### Resources

Mobile Apps Dev
Database Users
javascript
java
csharp
php
android
MS Developer
developer works
python
ios
c
html
jquery
RDBMS discuss
Cloud Virtualization
Database Dev&Adm
javascript
java
csharp
php
python
android
jquery
ruby
ios
html
Mobile App
Mobile App
Mobile App