Maximum Depth of Binary Tree | Height of Tree| Tree Data Structure playlist C++ | Hello World

  Рет қаралды 11,631

Hello World

Hello World

Күн бұрын

Пікірлер
@hikikomori9387
@hikikomori9387 2 жыл бұрын
I don't know how do we even learn to think like that, the way you came up with the solution recursively, already having an intution what the final recursive call going to return and building up to the final solution. Do people who are really good at DSA just born with this talent? or does it come from practice. I don't think I'll even be able to be as good as you or any other DSA KZbinr. Some people are too good to be true. I'm really beating myself over it and getting depressed.
@HelloWorldbyprince
@HelloWorldbyprince 2 жыл бұрын
nobody born with the talent expect Karna ( in mahabharat ) and u don't need to be like me or any other KZbinr u just have to be better than yourself bass be consistent buddy u will do it
@supriyamanna715
@supriyamanna715 Жыл бұрын
woah woah woah, bhaiya has seen enough rejections and a hell lot of wrong ways of solving problems which make his explaination so easy, its same for all
@deep1998-j1v
@deep1998-j1v 23 күн бұрын
This type of dry run i was looking for. I directly searched for your video bcz i knew it, i will get my doubt cleared. Great tutorial, as always.
@satyaprakashsingh952
@satyaprakashsingh952 3 жыл бұрын
Guru ji pan papper wala sabse best hai isi pr continue rhiye
@HelloWorldbyprince
@HelloWorldbyprince 3 жыл бұрын
Thanks 👍 dude
@AAYUSHSHARMAPCE21CS002
@AAYUSHSHARMAPCE21CS002 9 ай бұрын
Finally I understood this topic just because of you!!!! Thankyou sirr!!!!❤
@ferozekhan4021
@ferozekhan4021 Жыл бұрын
Bhut acha smjhaty ho bhai. Thank u 🎉
@rohitsoni5491
@rohitsoni5491 10 ай бұрын
Great Video Brother :) my friend suggested your tree videos, truly commendable.
@akulanvn381
@akulanvn381 Жыл бұрын
Bhaiya you are the best in explaining thank you yaar. i understood everything so clear.
@kamalkushwaha4908
@kamalkushwaha4908 3 жыл бұрын
Got more clear understanding...Thanks🙏
@HelloWorldbyprince
@HelloWorldbyprince 3 жыл бұрын
Thanks for sharing feedback
@AnkitKumar-oz6wl
@AnkitKumar-oz6wl 2 жыл бұрын
Bhaiya hum root->left mei kitne node hai unko store kar lenge ek variable mei and then root ->right ko bhi store kar lenge and maximum print kar denge. Sahi approach hai bhaiya
@HelloWorldbyprince
@HelloWorldbyprince 2 жыл бұрын
yess, u can , lekin isse better ki ek baar iss approcah ko dry run kijiye and then please code karke submit kijiye and fir naya yaha comment karke mujhee v bataa dena aap
@vitaminprotein2217
@vitaminprotein2217 2 жыл бұрын
we can do straight bfs traversal as height of the tree would be= no.of levels,but ya if height of left and right sub tree are asked the we can do like as taught vector ans; // edge case if(!root) return 0; queue q; q.push(root); while(!q.empty()) { vector temp; int size = q.size(); for(int i=0; ileft) q.push(node->left); if(node->right) q.push(node->right); temp.push_back(node->val); } ans.push_back(temp); } return ans.size(); }
@HelloWorldbyprince
@HelloWorldbyprince 2 жыл бұрын
yes bro
@alexmercer5870
@alexmercer5870 3 жыл бұрын
Arey Bhai Bhai bhai bhai! Kya mast smjhaate ho bhai❤️ Thanks for being exist🔥
@HelloWorldbyprince
@HelloWorldbyprince 3 жыл бұрын
Thanks brother you exist for listening me
@mohitsrivastavaofficial
@mohitsrivastavaofficial 11 ай бұрын
13:10 done.
@sudhadevi6692
@sudhadevi6692 Жыл бұрын
I was able to solve it from different approach .. but thanks for this ❤ 📹
@HelloWorldbyprince
@HelloWorldbyprince Жыл бұрын
Most welcome 😊
@tanvisharma6879
@tanvisharma6879 3 жыл бұрын
Homework Done! Can't thank you enough bhaiya:D
@HelloWorldbyprince
@HelloWorldbyprince 3 жыл бұрын
Just spread this channel 😁
@itsaayush7357
@itsaayush7357 Жыл бұрын
Bhaiya please AAP recursion tree se he recursion ka code btaya karo...usme concept ek dum badiya clear hota he...ese m dande bnakr thoda ajeeb sa lagta h
@AbhishekKumar-de3eo
@AbhishekKumar-de3eo 3 жыл бұрын
Question ko solve krne lga.. Total No. Of node se, leftmost,rightmost se 40 mins nikal gye.. most test fass rhe the After that, I view this full vedio... I was Like, Ekdum inhone wqt bdl diya, jazzbat bdl diye, zindgi bdl di...eh mazak ho rha hai 🥲
@HelloWorldbyprince
@HelloWorldbyprince 2 жыл бұрын
Waooo thanks Abhishek keep learning
@349_rahulbhattacharya6
@349_rahulbhattacharya6 21 күн бұрын
i did the homework maxDepth=4
@cr7johnChan
@cr7johnChan 2 жыл бұрын
Aapke graph ki series ke karn yeh khud kar paya hoon . int maxDepth(TreeNode* root) { queueq; if(root==NULL)return 0; int ans=0; TreeNode*temp; q.push(root); while(!q.empty()){ int s=q.size(); while(s!=0){ temp=q.front(); q.pop(); if(temp->left!=NULL){ q.push(temp->left); }if(temp->right!=NULL){ q.push(temp->right); } s--; }ans++; }return ans; }
@HelloWorldbyprince
@HelloWorldbyprince 2 жыл бұрын
thanks for the support buddy
@naitikrathore3317
@naitikrathore3317 2 жыл бұрын
This guy is very underrated
@maneeshapanu
@maneeshapanu 2 жыл бұрын
sir you explained really well thank you so much. Great explanation.
@HelloWorldbyprince
@HelloWorldbyprince 2 жыл бұрын
You are most welcome
@patilashish
@patilashish 2 жыл бұрын
Simple and accepted solution:- func maxDepth(_ root: TreeNode) -> Int { if root == null { return 0 } if root.left == null && root.right == null { return 1 } let maxDepthLeft = maxDepth(root.left) let maxDepthRight = maxDepth(root.right) return max(maxDepthLeft, maxDepthRight) + 1 }
@HelloWorldbyprince
@HelloWorldbyprince 2 жыл бұрын
Waooo amazing
@sahiltakwale1937
@sahiltakwale1937 2 жыл бұрын
🙏 Thanks a lot...
@HelloWorldbyprince
@HelloWorldbyprince 2 жыл бұрын
welcome please please share this channel in your college group
@pranithreddy
@pranithreddy Жыл бұрын
Bhaiya nice explanation
@HelloWorldbyprince
@HelloWorldbyprince Жыл бұрын
Thanks a lot
@gokulnaathb2627
@gokulnaathb2627 3 жыл бұрын
Sir, very nice explanation, thank you so much
@HelloWorldbyprince
@HelloWorldbyprince 3 жыл бұрын
You are most welcome
@nishabharti1971
@nishabharti1971 3 жыл бұрын
Thanks bhaiya
@HelloWorldbyprince
@HelloWorldbyprince 3 жыл бұрын
Your welcome Nisha Keep learning and sharing my channel with your friends and colleagues
@RN-jo8zt
@RN-jo8zt 11 ай бұрын
definition of height of binary tree is really confusing according to definition Height of Binary tree is the number of edges along the longest path from root to leaf. where leaf node height is 0 . but here it's different and leaf node height is 1. can you pls explain which definition is correct ?
@devbhattacharya153
@devbhattacharya153 3 жыл бұрын
Thanks a lot Prince Bhaiya
@HelloWorldbyprince
@HelloWorldbyprince 3 жыл бұрын
keep learning bhai
@color2653
@color2653 2 жыл бұрын
Thank you bro😀
@HelloWorldbyprince
@HelloWorldbyprince 2 жыл бұрын
thanks for the support bro
@jayanth1191
@jayanth1191 3 жыл бұрын
Great explanation bro 💥
@HelloWorldbyprince
@HelloWorldbyprince 3 жыл бұрын
Thanks buddy 😊😊
@cr7johnChan
@cr7johnChan 2 жыл бұрын
Done Bhai!!!!Shukriya
@HelloWorldbyprince
@HelloWorldbyprince 2 жыл бұрын
🤩🤩
@AyushGupta-ux4gq
@AyushGupta-ux4gq 3 жыл бұрын
Thanks bro😁😁
@HelloWorldbyprince
@HelloWorldbyprince 3 жыл бұрын
Keep learning buddy
@sanjeevgupta2200
@sanjeevgupta2200 2 жыл бұрын
Sir Hume iska iterative solution ni krna haii ?? Ya karna chaiye
@wantbebigcoder2117
@wantbebigcoder2117 Жыл бұрын
Done
@HelloWorldbyprince
@HelloWorldbyprince Жыл бұрын
👏
@AmanSingh-ph9wg
@AmanSingh-ph9wg Жыл бұрын
done
@HelloWorldbyprince
@HelloWorldbyprince Жыл бұрын
nice
@shivduttjha3502
@shivduttjha3502 3 жыл бұрын
♥️♥️♥️
@HelloWorldbyprince
@HelloWorldbyprince 3 жыл бұрын
Thanks buddy for lots of Love
@jeetkishore7972
@jeetkishore7972 2 жыл бұрын
int depth(node* root ) { static int h = 0; if (root == NULL) { return 0 ; } h++; if (root->left == NULL) { depth(root->right); } else if(root->right){ depth(root->left); } else return -1; return h; }
@HelloWorldbyprince
@HelloWorldbyprince 2 жыл бұрын
good work dost keep learning
@abhisheksamboddu6580
@abhisheksamboddu6580 2 жыл бұрын
class Solution { public: int h=0; int ans=0; int maxDepth(TreeNode* root) { findans(root); return ans; } void findans(TreeNode* root){ if(root!=NULL){ h++; ans=max(ans,h); findans(root->left); findans(root->right); h--; } } };
@HelloWorldbyprince
@HelloWorldbyprince 2 жыл бұрын
amazing code work bro keep learning like this
@mdwahid1099
@mdwahid1099 Жыл бұрын
Sir, very nice explanation, thank you so much
@HelloWorldbyprince
@HelloWorldbyprince Жыл бұрын
You are most welcome
@UjjwalSharma385
@UjjwalSharma385 7 күн бұрын
Done
@anonymous090
@anonymous090 2 жыл бұрын
Thank you Bhaiya
@HelloWorldbyprince
@HelloWorldbyprince 2 жыл бұрын
welcome dear
Мен атып көрмегенмін ! | Qalam | 5 серия
25:41
Une nouvelle voiture pour Noël 🥹
00:28
Nicocapone
Рет қаралды 9 МЛН
人是不能做到吗?#火影忍者 #家人  #佐助
00:20
火影忍者一家
Рет қаралды 20 МЛН
小丑女COCO的审判。#天使 #小丑 #超人不会飞
00:53
超人不会飞
Рет қаралды 16 МЛН
L14. Maximum Depth in Binary Tree | Height of Binary Tree | C++ | Java
8:05
Coding Interviews Be Like
5:31
Nicholas T.
Рет қаралды 6 МЛН
L16. Diameter of Binary Tree | C++ | Java
13:47
take U forward
Рет қаралды 406 М.
Мен атып көрмегенмін ! | Qalam | 5 серия
25:41