Hanji beta, jldi he resume krege. Thankyou for the love and support. If you like our efforts, will you like to write a few words about us here (www.quora.com/How-do-I-start-learning-or-strengthen-my-knowledge-of-data-structures-and-algorithms )
Thankyou beta! I am glad you liked it. I hope that you are watching till the end and trying to understand what, how, and especially why of the problem. If you like our efforts, will you like to write a few words about us here (www.quora.com/What-are-the-good-websites-to-learn-data-structures-and-algorithms )
I am glad you liked it. I also hope that you are watching till end and trying to understand the what, how and especially why of the problem. If you like our efforts, we request a review g.page/Pepcoding/review?rc You can subscribe to our channel here th-cam.com/users/Pepcodingabout?view_as=subscriber
Sir, how do you come up with such wonderful approaches (the last one)? I really tried to come up the the best approach (S.C. - O(h) and T.C. - O(n)) but, wasn't able to do so. Any sugesstion from anyone is appriciated. Also, love your teaching so much.
Sir can you please tell why method 1 doesn't give correct output although both are pushing same value to the stacks... METHOD 1:- Pair mp=new Pair(node,0); ls.push(mp); rs.push(mp); METHOD 2(correct) :- ls.push(new Pair(node,0)); rs.push(new Pair(node,0));
It's like you have two journeys to plan simultaneously but instead of giving two separate cars you are giving a common car for both the journeys (i.e same pair address is passed in method 1 for both the stacks and change in pair due to stack right will affect the pair shared tp left stack and thus the result )
Sir when top. state ==1 then usme pehle top. node return hoga na fir agla push hoga Kyonki agr pehle agla(right) push ho gya toh stack k top Vo aa jayega???
Sir es problm me stack ko jeb hem next form normal inorder function me pahli bar call kerte hai to inorder pe jate hi wha se return kerte hai to hme pahla left ya right node milta hai uske bad usi stack ko fir se kerte hai jha tak fill huwa rhta hai to wo whi se start hota hai jha tak inorder me pahle ho chuka tha ye stack it mens ek bar stack jo bher gya wo her jagrh bhera huwa hi so hoga
beta, jo stack mei object hai aur jo object hmare paas hai wo dono same hain. dono jagah pointers hai asli object ke jo heap mei pada hai. To chahe pehle stack mei add karke baad mei update karo. Change aa jaega.
@@Pepcoding Haa sir kya aap ye bata sakte hai ki abhi kaunse topics pura hogaye foundation mein stack queue binary trees generic tree aur recursion and bst chod ke
I am glad you liked it. I also hope that you are watching till end and trying to understand the what, how and especially why of the problem. If you like my efforts, I request a review g.page/Pepcoding/review?rc
@@akhilgupta3664 beta shuru ho chuka hai ana. wo bhi free hai. sara content free hoga. paid rahega sirf classroom ya zoom meeting mode. paid aur free ke content mei koi farak bhi nahi hoga
@@Pepcoding tho sir jo aap backtracking and recursion dp ya aur alag algorithm paradigm ye sab video bana rahe hai recent mei hi wo level 2 ka part hai kya ?? sir and site wala content Sara TH-cam pe haina ??
sir if possible, weekly dev ke 1-1 project ke videos bhi dalwa dijiya kariye, because sometime ds-algo exhaust us, so dev will make mind refresh and we get decent projects too.(If Possible)
Sir please uplaod level 2 soon!! I have covered max playlist and waiting for level 2....thanks for efforts and loved your every single video❣️
Hanji beta, jldi he resume krege.
Thankyou for the love and support. If you like our efforts, will you like to write a few words about us here (www.quora.com/How-do-I-start-learning-or-strengthen-my-knowledge-of-data-structures-and-algorithms )
You have very good explaining skills...thank you for clean explanation..
Best and detailed explanation! Keep the good work, sir !!
Thanks Man!
Keep learning and keep loving Pepcoding😊
Why can't we use recursive inorder traversals rather than iterative ones in the last and optimized approach??
Thank you sir for a clear explanation hence providing 3 methods to solve TSP
Thankyou beta!
I am glad you liked it. I hope that you are watching till the end and trying to understand what, how, and especially why of the problem.
If you like our efforts, will you like to write a few words about us here (www.quora.com/What-are-the-good-websites-to-learn-data-structures-and-algorithms )
@@Pepcoding Sure sir, thank you so much sir ❤
sir, in best aproach method stack static nhi h fir stack mein nodes updated kaise h value return krne ke baad?
Sir your explanation skills are amazing
I am glad you liked it. I also hope that you are watching till end and trying to understand the what, how and especially why of the problem.
If you like our efforts, we request a review
g.page/Pepcoding/review?rc
You can subscribe to our channel here
th-cam.com/users/Pepcodingabout?view_as=subscriber
@Pepcoding Sir, please resume uploading level 2 videos
😭😭 Life Saver Sir!!
Thanks buddy!
If you like our efforts, will you like to write a review about us here - g.page/Pepcoding/review?rc
in order iterative , reverse iterative wala is too good :)
Thankyou buddy!
Keep learning and keep supporting!😍😊
Nice explanation sir and thank you sir for providing such a great content for free
Keep learning.
And for better experience, visit nados.io, where you will get well curated content and career opportunities.
best explanation possible
Glad it was helpful!
Keep learning.
And for better experience, visit nados.io, where you will get well curated content and career opportunities.
Sir, how do you come up with such wonderful approaches (the last one)?
I really tried to come up the the best approach (S.C. - O(h) and T.C. - O(n)) but, wasn't able to do so.
Any sugesstion from anyone is appriciated.
Also, love your teaching so much.
Qualitative Content, Sir!
Glad you think so!
Sir, plz continue binary search tree playlist.
Kaafi time ho gya....is pr videos nhi ban rhe
PS: you inspired me a lot.
thank you. hanji wo searching and sorting topic mei bnaunga
Great explanation sir. Thank You!
Glad you liked it.
Keep learning.
For better experience and well organised content explore nados.pepcoding.com
Great explanation !!
Sir can you please tell why method 1 doesn't give correct output although both are pushing same value to the stacks...
METHOD 1:-
Pair mp=new Pair(node,0);
ls.push(mp);
rs.push(mp);
METHOD 2(correct) :-
ls.push(new Pair(node,0));
rs.push(new Pair(node,0));
lg to sahi rha hai bro to use
It's like you have two journeys to plan simultaneously but instead of giving two separate cars you are giving a common car for both the journeys (i.e same pair address is passed in method 1 for both the stacks and change in pair due to stack right will affect the pair shared tp left stack and thus the result )
if we are keeping a state variable for every node then space complexity will be O(N)?
stack me jitne values hongi utne state variables bnenge so space log(n) or height of tree hi rhega
@@kashba okk
hey sir if let say (root.data + somenode.data== target) vo chiz iterator vaala soln handle krpayega ? for testcase [2,1,3]
hanji ofcourse
hats off man! god bless you.
For better experience and well organised content sign up on nados.io
And for being updated follow us on Instagram instagram.com/pepcoding/
Sir when top. state ==1 then usme pehle top. node return hoga na fir agla push hoga Kyonki agr pehle agla(right) push ho gya toh stack k top Vo aa jayega???
hum store kr rahe h pehle top ko fir stack me push kr rahe h.
Sir es problm me stack ko jeb hem next form normal inorder function me pahli bar call kerte hai to inorder pe jate hi wha se return kerte hai to hme pahla left ya right node milta hai uske bad usi stack ko fir se kerte hai jha tak fill huwa rhta hai to wo whi se start hota hai jha tak inorder me pahle ho chuka tha ye stack it mens ek bar stack jo bher gya wo her jagrh bhera huwa hi so hoga
yes
Sir aap state baad mai update kr rhe ho pehle push kr rhe to top change hojayega na ab aur wo changes kaise show ho rhe hai stack mai
beta, jo stack mei object hai aur jo object hmare paas hai wo dono same hain. dono jagah pointers hai asli object ke jo heap mei pada hai. To chahe pehle stack mei add karke baad mei update karo. Change aa jaega.
@@Pepcoding Ok, sir got the point I was trying this in cpp that's why I asked this. Thanks for the explanation sir
Sir, please make video on boundary nodes of binary tree uska dry run karwana sir 🙏
Will this code work even when both of the keys are on the same side of the root. In that case both the events will be on same stack right?
yes it will. try once.
link to iterative inorder
sir ye last video hai kya bst pe foundation mein ?
Ji. Foundation mei itna he. Levelup mei AVL aur 25 BST ke sawaal aur karenge.
@@Pepcoding Haa sir kya aap ye bata sakte hai ki abhi kaunse topics pura hogaye foundation mein stack queue binary trees generic tree aur recursion and bst chod ke
I tried to implement it in geeks for geeks it is showing TLE
It is also showing tle on leetcode, apko pta chala ki kya galat hai isme
@@justarandomguy6106 if we are keeping a state variable for every node then space complexity will be O(N)?
@@paraskumar693 question kya tha vo bhi yaad nhi ab mujhe😞
@@paraskumar693 Nodes in the stack is of order log(n) so it will be log(2n) not O(n).
Sumeet sir why you are not uploading video these days
Plz upload more questions on BST.
Ji bilkul. Sirf ek month mei trees par 100 question dalenge.
thank you so much sir....you are great 🔥
Bhot hi acha
I am glad you liked it. I also hope that you are watching till end and trying to understand the what, how and especially why of the problem.
If you like my efforts, I request a review
g.page/Pepcoding/review?rc
Sir stack 2 le rhe hai hel ek stack me nhi ker rhe hai to space to 2h hoga na sir
wo O(h) he maana jaega.
@@Pepcoding ha sir kyoki wo koi effect nhi dalega
Sir kl sunday ek vaari vo song sunayiyega plz
jis din mai din mei 25 question bnaunga, us din mai gana deserve karunga
@@Pepcoding sir hats off to your dedication level
Sir is video ka Naam galat ho gya, ye more approach hai, isme question likha hai
Theik karte hain beta. Thanks for reporting
Sirji time and space complexity daal dijiye please
ji beta
thanks
Keep learning.
And for better experience, visit nados.io, where you will get well curated content and career opportunities.
Sir ye Bst ke last video hai kya iske aage ke questions aur kab aayege ??
Level-2 ki videos me
@@Pepcoding wo sir paid hoga..ya TH-cam pe hi upload hoga ??
@@akhilgupta3664 beta shuru ho chuka hai ana. wo bhi free hai. sara content free hoga. paid rahega sirf classroom ya zoom meeting mode. paid aur free ke content mei koi farak bhi nahi hoga
@@Pepcoding tho sir jo aap backtracking and recursion dp ya aur alag algorithm paradigm ye sab video bana rahe hai recent mei hi wo level 2 ka part hai kya ?? sir
and site wala content Sara TH-cam pe haina ??
hanji, site wala sara content youtube pe hai. last 12 videos level 2 ka part hain
@Pepcoding find operation HASHMAP ko use kr ke O(1) operation m ho sakta h aur space O(n)
hashmap o(1) precise nhii hota amotised o(1) hotaa haai
sir aaj dp ke questions aur dalenge?
Koshish thi. Bne hue hain. Par bhaiya jo edit karte hain unko aj leave lena pda.
@@Pepcoding no problem sir
sir if possible, weekly dev ke 1-1 project ke videos bhi dalwa dijiya kariye, because sometime ds-algo exhaust us, so dev will make mind refresh and we get decent projects too.(If Possible)
August 5 ko first dev stuff is coming
@@Pepcoding oh cool, looking forward to it