Register for Coding Ninjas Scholarship Programme: bit.ly/CNSCHOLARSHIP
@NaveensinglaYT2 жыл бұрын
its been 4 years since this video was posted but it is still the best video on the internet
@yuv545 жыл бұрын
Man!! Enjoyed a lot. Very well explanation and love the way you explain. Keep it up...
@anujjadhav27713 жыл бұрын
Very well explained, also which editor is sir using?
@abhi4unme20026 жыл бұрын
height in case of null should be -1 not zero, if you assume height of root is 0 not 1.
@geekySRM3 жыл бұрын
If you do -1, then you should do leftHeight + rightHeight + 2.. which is the same thing what Sir did.
@debasismandal19244 жыл бұрын
I'm a simple person I see vi I press like
@namantiwari71556 жыл бұрын
Amazing explanations, helped me a lot!
@RCorpVideos6 жыл бұрын
Hi Sir, I think in height() one more if condition should be there for checking the leaf and here is the total code for finding the height of the binary tree. Well I am writing this code in C language. int height(struct node *head){ if(!head){ return 0; } if(!head->left && !head->right){ return 0; } return 1+ max(height(head->left),height(head->right)); }
@mohitarora21905 жыл бұрын
yeah but this condition is not necessary. it will still work without this condition.
@sarfarazalam60774 жыл бұрын
Great explaination. Thank you!
@CodingNinjasIndia4 жыл бұрын
Thank you
@kaushtubrawat61146 жыл бұрын
Very nicely explained.. thnx sir
@mohitarora21905 жыл бұрын
how it this better? it is doing it in O(n2) time complexity
@abhishekgautam10635 жыл бұрын
In which course this topic is been taught?
@MultiSudipta4 жыл бұрын
Data structure, algorithm....
@vivekgr30014 жыл бұрын
Good explanation
@neetisharma37685 жыл бұрын
thank you :)
@aniketsriwastva63454 жыл бұрын
Great explaination
@letsrock73546 жыл бұрын
well explained
@durbijkewat76714 жыл бұрын
Diameter Of Binary Tree = left_height + right_height + 1
@CodingNinjasIndia4 жыл бұрын
IGot queries related to Binary tree , Let us know in the comments section In this video you will learn how to calculate the diameter of a Binary tree with a slightly different approach. 0:20: Diameter of a Binary Tree. 2:06 : Assumptions for calculating the diameter of a Binary tree. 3:10 Condition where diameter of binary tree will be the sum of lh and rh. 3:30 Condition where both the nodes are on the left side in that case lhe diameter will be ld. 3:35 Condition where both the nodes are on the right side in that case the diameter will be rd. 4:30 Code for the problem 10:00 Time complexity for Binary tree.
@CodingNinjasIndia3 жыл бұрын
Join our Coding Ninjas official telegram community here: t.me/codingninjas_official