That's what we all wanted from start ❤️❤️Make videos of longer duration but explain properly. This was best, perfectly explained. ❤️
@willturner34403 жыл бұрын
Only and Only in apna college, hats off to the great ma'am
@krishnanarwani81053 жыл бұрын
Bohot hi pyara concept...Maza aa gya... Kya toh samjhaya he...Waah
@ShubhivDogra3 жыл бұрын
this course made me answer all the interview qns asked in my college campus placenment -- 14lpa-gap
@sakshamjain37753 жыл бұрын
@Shubiv Dogra what were the questions based upon??
@ShubhivDogra3 жыл бұрын
@@sakshamjain3775 based on stacks and linked lists..
@rahul_ji213 жыл бұрын
@@ShubhivDogra congrats
@sumitKumar-pf9xo3 жыл бұрын
Congo bro 🤗🤗🤗
@chanduchandrakanth51313 жыл бұрын
Bro Which clg r u from?
@sudhanwapande20403 жыл бұрын
Bohot aala samjhaya aapne.. itna tough concept ko easy kardiya🙏
@PankajSingh-vi3fy3 жыл бұрын
love that music of keyword.. so satisfying 😌
@upasanapan17903 жыл бұрын
struct Info { int size; int max; int min; int ans; bool isBST; }; if(root==NULL){ return{0,INT_MIN,INT_MAX,0,true};//will only come here if already traversed left and right / left is NULL so we put INT_MAX in rightInfo.min as null means it has to be greater than root in all cases and we put INT_MIN in leftInfo.max as null means it has to be less than root in all cases. LOOK ORDER IS REVERSED FOR max and min AND INT_MIN and INT_MAX. } p.s IT took me 3 days to realise this.sed life
@beenaasha5063 жыл бұрын
Great explanation
@satyam50363 жыл бұрын
Who noticed this is dynamic programing on trees to avoid repetition
@lokeshdulani60353 жыл бұрын
fucking awesome far better explanation than content available at other sites
@avronilbanerjee53022 жыл бұрын
didi you are a legendary person !
@adityabhandari66883 жыл бұрын
great explanation mam, this is what is called perfect explanation
@devilronak72623 жыл бұрын
op, heads off to this video, what a great explanation, jod or what?
@devilronak72623 жыл бұрын
@@utkarshverma2604 😂😂😂
@its_neel_ok3 жыл бұрын
@@devilronak7262 ya toh pubg wala ha kaya.....xD
@devilronak72623 жыл бұрын
@@its_neel_ok 😂
@its_neel_ok3 жыл бұрын
@@devilronak7262 xD
@devilronak72623 жыл бұрын
@@its_neel_ok xD
@rajveerbari791 Жыл бұрын
COOKING 🍳 AND SERVING(TEACHING) US AT THE SAME TIME🤣 We can hear 👂 the cooper's whistle behind.
@hustlewithVaibhav3 жыл бұрын
Thank you 🙏🙏
@shreyankshrestha92743 жыл бұрын
bahut sahi ❤❤
@Zeno_Yoru3 жыл бұрын
Vaiya. Lecture 28.9???
@SubhamKumar-fr7gw3 жыл бұрын
paikhana kare me t ek number bate e log
@NiteshSingh53753 жыл бұрын
I think last statement spoken by tutor is not correct. Ans=2 because of max. BST found is due to 20 & 5 but not 15&30. we can not take partial(one side either left or right) Binary tree to accept it as a BST.
@nazeershaik981211 ай бұрын
#include #define ll long long #define loop(i,n) for(int i = 0; i < n; i++) #define loop1(i,n) for(int i = 1; i left); vector rt = help(root->right); vector curr (5,0); curr[3]=1+lt[3]+rt[3]; if(root->data>lt[1] && root->datadata,lt[0]); curr[1]=max(root->data,rt[1]); curr[2]=1; curr[4]=curr[3]; return curr; } curr[4]=max(lt[4],rt[4]); return curr; } int largestBST(Node* root){ return help(root)[4]; } int main() { Node* root; cout
@ritwickrana32552 жыл бұрын
as i am moving forward in this course no. of likes are and views are decreasing i guess they are not able to continue in this journey
@tarunbisht80163 жыл бұрын
I don't think there is any need to check whose value is minimum left info, right info, and current root value, cause it's obvious that left info's min value will be min and if it is not the case then it's not a bst.
@naiyerabbas64813 жыл бұрын
Yeah!! I was also thinking about it.. We don't need min and max
@avronilbanerjee53022 жыл бұрын
@@naiyerabbas6481 no you have to check what if the left or right child is NULL ?? then the min would be different
@letsdoeverythinginoneweek93983 жыл бұрын
IF ROOT ==NULL IT NOT ONLY SATISFY THE NO NODE CONDITION BUT IT ALSO SATISFY THE LEAFT NODE CONDITION
@pekkingjackal11803 жыл бұрын
Yes,you are right but I cannot understand the logic, can you please explain it?
@SagarSagar-ym5wx3 жыл бұрын
very good
@maneshwarsingh86883 жыл бұрын
19:55 Wouldn't curr.min = leftInfo.min and curr.max= rightInfo.max directly be applicable instead of comparing with root->data since the said root is already validated to be a BST! So leftInfo.min would always be less than root->data (heck, root->data is greater than leftInfo.max too) and similarly for curr.max also.
@sameeryadav88573 жыл бұрын
yes i also think so... that was not necessary...
@piyushlohiya19773 жыл бұрын
I also thought that and it is correct!! What she said is just unnecessary
@nishantchauhan25963 жыл бұрын
@Maneshwar Singh No brother we need to do that. Consider a case where a node has only right subtree than in that case curr.min=leftInfo.min will not work because now curr.min is root->data.so we need to that. Though that whole line is not required this will do the work curr.min=min(leftInfo.min , root->data)
@adarshdubey17843 жыл бұрын
Bro , I asked same doubt in comment section and then I started to search if someone has encountered same doubt or not, then I found you ....So, I think There is no need to write that lengthy stuff
@Subhankar4153 жыл бұрын
@@adarshdubey1784 There is a need. Look at the comment above
@hardikagarwal76523 жыл бұрын
curr.min and curr.max ko if statement ke bahar hona chahiye
@vinaydangayach3863 жыл бұрын
yes but dont know why this code is not giving error?
@chirag-sg4kd3 жыл бұрын
same doubt but agr bahar rakh rahe hai to ans 1 aa raha hai
@sanketbhagat12223 жыл бұрын
@@chirag-sg4kd nahi, bahar rakha to 2 aa raha hai. agar 20 to 10 se replace kiya jai to 4 ata hai, means min, max ko if ke bahar rakhne se sahi output aa raha hai..
@piyushlohiya19773 жыл бұрын
@@sanketbhagat1222 if ke bahar bhi aur andhar bhi hona chahiye
@TUSHAR-mj1en3 жыл бұрын
@@vinaydangayach386 dekh bhai min max ko update karne ka koi fayada nhi h kyuki jab isbst false h to bade wale if condition bhi false hoga uka min max kabhi bhi compare hoga hi nhi bro aur uske karn ab uss node to milakar kabhi bhi answer nhi banega
@vaibhavbelekar46532 жыл бұрын
Student : Notes de de Thakur......
@adarshdubey17843 жыл бұрын
I have doubt on line no.37...if current node is BST then on line no.38 the minimum value of current node should be "minimum value from left subtree", as we mentioned left subtree is also bst ..?
@cenacr0073 жыл бұрын
it's a recursive approach, think in that way, will your logic work in case of leaf nodes and nodes with only right subtree. think for one node, the last one and slowly move upwards, don't pick random node and only think about it.
@namangoyal84773 жыл бұрын
Excellent
@AdarshSingh-on5fy3 жыл бұрын
#include using namespace std; class node{ public: int data; node *left; node *right; node(int d){ data=d; left=NULL; right=NULL; } }; class bst{ public: int size; int max; int min; int ans; bool isbst; }; bst largestbst(node * root){ // root is null and size is 0 if(root==NULL){ return {0,INT_MAX,INT_MIN,0,true}; } // leaf node condition if(root->left== NULL and root->right ==NULL){ return{1,root->data,root->data,1,true}; } bst left=largestbst(root->left); bst right=largestbst(root->right); bst curr; curr.size=(1+left.size+right.size); if(left.isbst and right.isbst and left.maxdata and right.min>root->data){ curr.min=min(left.min ,min(right.min,root->data)); curr.max=max(right.max ,max(left.max,root->data)); curr.ans=curr.size; curr.isbst=true; return curr; } curr.ans=max(left.ans,right.ans); curr.isbst=false; return curr; } int main(){ /* 15 / \ 20 30 / 5 */ node *root=new node(24); root->left=new node(20); root->right=new node(30); root->left->left=new node(5); cout
@Saurabh-gg9lv2 жыл бұрын
int max and int min
@santoshbhupati35793 жыл бұрын
Thankyou
@royal_bettiah223 жыл бұрын
Nice Sir
@hardikagarwal76523 жыл бұрын
15 and 30 will not be a BST
@AmrutanshuMishra-dp1mf Жыл бұрын
i had a doubt when we are updating the value of our curr minimum and maximum cant we simply just say curr.min=left.min and curr.max=right.max as we are checking if the current node is a bst before this ??????
@uxxrhiiikgfdsdvhj Жыл бұрын
exactly my point
@sanjayswami11553 жыл бұрын
i think there was no need to right extra conditions for the leaf nodes and it will automatically get calculated , anyone correct me if I am wrong
@pulkitmittal5843 жыл бұрын
yes
@sanketbhagat12223 жыл бұрын
Mam, please correct that, curr.min & curr.max if ke bahar hona chahiye..
@piyushlohiya19773 жыл бұрын
Kyo?
@Subhankar4153 жыл бұрын
Does not make a difference anyways. for the other case, you will not be using the values anyways
@shauryashekharsahu74853 жыл бұрын
Aman bhaiya unacademy m aap padhayenge ya nhi plz bataiye mai bura fas gya hu
@vansh63683 жыл бұрын
🙂😂
@omkarmhaske81203 жыл бұрын
comment 0
@willturner34403 жыл бұрын
At last why we are not set the value of curr. Max and curr. Min
@shubhamgoel3998 Жыл бұрын
int largestBst(node *root,int *Max,int *Min,bool *isBst) { if (root==NULL) { *isBst = true; return 0; } int lMax,lMin,rMax,rMin; bool isBstLeft,isBstRight; int left = largestBst(root->left,&lMax,&lMin,&isBstLeft); int right = largestBst(root->right,&rMax,&rMin,&isBstRight); *Max = root->data; *Min = root->data; *isBst = true; if (isBstRight == false || isBstLeft == false) { *isBst = false; return max(left,right); } if (root->left!=NULL) { if (lMax > root->data) { *isBst = false; } else { *Max = max(*Max,lMax); *Min = min(*Min,lMin); } } if (root->right!=NULL) { if (rMin < root->data) { *isBst = false; } else { *Max = max(*Max,rMax); *Min = min(*Min,rMin); } } if (*isBst == false) { return max(left,right); } return 1+left+right; }
@divyanshugautam23043 жыл бұрын
cant we do it like take the inorder then the largest sorted sub array of preorder is no of nodes of largest bst
@adityaagarwal35112 жыл бұрын
why we haven't used public in the structure info
@pranjalrajput28862 жыл бұрын
Lecture 28.9 is Missing
@its_neel_ok3 жыл бұрын
what is the meaning of ans in the list when explaining isn't it the size of the largest BST...then how come it is equal to the root??? I didn't understand that
@anonymouspromax3 жыл бұрын
28.9 lecture??
@lavyadav23962 жыл бұрын
I think on line no. 41 there will be change ----->>> curr.ans = max ( curr.size , max ( leftinfo.ans , rightinfo.ans ) );
@Rohan-ov3fr3 жыл бұрын
Bhai kuch samjh bhi aaya kuki mugje ek baar me kuch ni aaya 🥺🥺
@depression_plusplus61203 жыл бұрын
Itna easily samjhaya hai fir bhi agar samaj na aaya plz revise kare apni basics
@AlokSingh-jw8fr3 жыл бұрын
Can anyone please explain me at 12:24 di has made a constructor in structure how's it possible constructors are to be made in classes???????
@vasukotadiya62353 жыл бұрын
In C++ we can make constructors in structure... You are right but in C language
@adityabhandari66883 жыл бұрын
bro watch full video, it was an error which she corrected at the end
@NareshKumawat-w9z Жыл бұрын
this is not applicable in all conditions
@PegasiuuuS3 жыл бұрын
Can't we just find inorder traversal and check for size of longest increasing sub array in that inorder traversal
@azeezmoiz91953 жыл бұрын
It doesnt work that way take a sample input from GFG and dry run your logic
@tarunbisht80163 жыл бұрын
@@azeezmoiz9195 No, i think it will work perfectly just space complexity o(n) ho jayega
@tarunbisht80163 жыл бұрын
@@azeezmoiz9195 even we can do it without using any vector also
@promphotos54033 жыл бұрын
@@tarunbisht8016 naah, we can have a case in which two bst subtrees can be combined to give a sorted subarray in a inorder traversal array.
@SagarSagar-ym5wx3 жыл бұрын
ma'am please send the source code
@jaydalsaniya69863 жыл бұрын
Avaaz bohot Dabi dabi lagg rahi hai
@Priyanka_Aarna3 жыл бұрын
First one 😊
@tanmayjain85423 жыл бұрын
1st comment
@ayushbankia90043 жыл бұрын
Anyone 12th pcm?
@pathikshah3 жыл бұрын
JEE me kitne aaye ?
@ayushbankia90043 жыл бұрын
@@pathikshah bhai bahut kharab aye. 96.2.
@pathikshah3 жыл бұрын
Toh padhna JEE ka, idher kya kr rha hai? DSA college me bahut time milega..