Insert tree node


what wrong in the code why I am not able to insert data at root. Also I am passing with reference of root to make actual change happen in root…

Check now.

got it can u explain the diameter of tree question complexity in terms of recurrence relation that u generally used in DAA

I think there are 2 approaches discussed in the course , one is O(n^2) beacause there you have to check the height of each node and you know that complexity to find height is O(n).
Another approach was of O(n) which was post order(bottomup) approach.

@pratyush63 can u come on chat …

I hope I’ve cleared your doubt. I ask you to please rate your experience here
Your feedback is very important. It helps us improve our platform and hence provide you
the learning experience you deserve.

On the off chance, you still have some questions or not find the answers satisfactory, you may reopen
the doubt.