Construct Binary Tree From PreOrder And Inorder (Code) - C++

  Рет қаралды 56,393

Coding Ninjas

Coding Ninjas

Күн бұрын

Пікірлер: 55
@CodingNinjasIndia
@CodingNinjasIndia 3 жыл бұрын
Join our Coding Ninjas official telegram community here: t.me/codingninjas_official
@ankitbanerjee4868
@ankitbanerjee4868 4 жыл бұрын
I was searching for the explanation for this problem on youtube. Believe me, when I say this, this explanation is the best explanation I got.
@durjaarai7737
@durjaarai7737 3 жыл бұрын
100%
@sankalparora9374
@sankalparora9374 Жыл бұрын
Some people have a knack at explaning stuff, and Ankush Singla is one of them. Thanks for the explanation!
@CodingNinjasIndia
@CodingNinjasIndia Жыл бұрын
Hi @sankalparora9374, Thank you for the kind words! We hope that this video has helped you! Stay tuned to Coding Ninjas KZbin channel for more such content! Do check our Coding Ninjas Studio, where you can upskill for free and become a Ninja Coder: www.codingninjas.com/studio/home? If reading is your preference, you can find top articles to upskill in your career here: www.codingninjas.com/studio/library? If you would like to opt for a Coding Ninjas course, you can check our courses here: www.codingninjas.com/?
@ankitsharma8221
@ankitsharma8221 5 жыл бұрын
Awesome explanation. Just a suggestion: We can store all the values of the inorder in a lookup table and pass it as an argument Won't have to calculate the rootIndex each time :)
@ryan-bo2xi
@ryan-bo2xi 4 жыл бұрын
Excellent explanation ! It deserves more likes .. hats off
@renudixit3087
@renudixit3087 4 жыл бұрын
Awesome explanation , you make it so easy to implement, thanku
@SR-we1vl
@SR-we1vl 4 жыл бұрын
I've worked out the math for PostOrder Traversal. Is it good to go!? int lInS = inS; int lInE = rootIndex - 1; int rInS = rootIndex + 1; int rInE = inE; int lPoS = poS; int lPoE = lInE - lInS + lPoS; int rPoS = lPoE + 1; int rPoE = poE - 1;
@user-mi8ew2to8e
@user-mi8ew2to8e 4 жыл бұрын
Ab ja ke mere ko ye samajh me aaya hai...subscribed.
@unmeshguleri5306
@unmeshguleri5306 3 жыл бұрын
That was an awesome explanation, it was simple maths as told by you. Thank you for it.
@CodingNinjasIndia
@CodingNinjasIndia Жыл бұрын
Thank you for the kind words! We hope that this video has helped you! Stay tuned to Coding Ninjas KZbin channel for more such content! Do check our Coding Ninjas Studio, where you can upskill for free and become a Ninja Coder: www.codingninjas.com/studio/home? If reading is your preference, you can find top articles to upskill in your career here: www.codingninjas.com/studio/library? If you would like to opt for a Coding Ninjas course, you can check our courses here: www.codingninjas.com/?
@kuldeepnarayanminj
@kuldeepnarayanminj 4 жыл бұрын
best explaination on youtube
@AbhishekJha-wm5oq
@AbhishekJha-wm5oq 3 жыл бұрын
VERY GOOOD EXPLANATION!
@Deepak-jk1eh
@Deepak-jk1eh 4 жыл бұрын
very big thank you for this explaining generally i don't like to write comment on video but for this explanation i did this .
@anubhavnema613
@anubhavnema613 4 жыл бұрын
Awesome Explanation
@chandrahassoman6648
@chandrahassoman6648 5 жыл бұрын
What a nice explanation! Maza aa gaya.
@ankithans5916
@ankithans5916 3 жыл бұрын
you made it easy..
@NadinMagdy
@NadinMagdy 3 жыл бұрын
Indians if you're gonna talk hindi in the video, just WRITE IT IN THE TITLE
@gamingparlour1732
@gamingparlour1732 5 жыл бұрын
ek number sir
@MrPranavsss
@MrPranavsss 5 жыл бұрын
Great Explanation. Followed every bit of it. Thank you so much for this :)
@prakashshukla3558
@prakashshukla3558 3 жыл бұрын
Super cool awesome video , i will try to make video as good as this one.
@Sushil2874
@Sushil2874 5 жыл бұрын
Awesome explanation ...!!
@shubhiaggarwal7873
@shubhiaggarwal7873 6 жыл бұрын
The following list of letters are inserted into an empty bst:J,R,D,GT,E,M,H,P,A,F,QFIND final tree.....sir please tell me answer with explaination
@TW-uk1xi
@TW-uk1xi 4 жыл бұрын
It can be done in more easy way. You are using so many variable unnecessarily which makes code messed up. And this will be slow since you are searching root index every single time.
@sankalparora9374
@sankalparora9374 Жыл бұрын
Root to dhoondna hi padega...
@sankalparora9374
@sankalparora9374 Жыл бұрын
Zyada variables make code look way easier than the other implementations jisme only the seasoned tree developers can understand things.
@awaisakhtar1139
@awaisakhtar1139 3 жыл бұрын
We are finding the root using a loop so maybe in case of duplicate values, it might not give us the desired output. Any solution to this?
@abilashg3862
@abilashg3862 6 жыл бұрын
Sir , this is which kind of recursion?? top to bottom (or) bottom to top
@sahazeerks2363
@sahazeerks2363 5 жыл бұрын
top down recursion
@rethink20s
@rethink20s 5 жыл бұрын
This code is working fine in eclipse ide..but I tried this code in compititive programming console is showing stack overflow
@soham2732
@soham2732 3 жыл бұрын
Really cool explanation 🤟🏻 .. Thanks :)
@CodingNinjasIndia
@CodingNinjasIndia Жыл бұрын
Thank you for the kind words! We hope that this video has helped you! Stay tuned to Coding Ninjas KZbin channel for more such content! Do check our Coding Ninjas Studio, where you can upskill for free and become a Ninja Coder: www.codingninjas.com/studio/home? If reading is your preference, you can find top articles to upskill in your career here: www.codingninjas.com/studio/library? If you would like to opt for a Coding Ninjas course, you can check our courses here: www.codingninjas.com/?
@shivammaheshwari8465
@shivammaheshwari8465 4 жыл бұрын
Great Explanation, best on youtube
@devendrameena2540
@devendrameena2540 6 жыл бұрын
awesome explanation dude.. you've got a new subscriber!!
@questtech2979
@questtech2979 4 жыл бұрын
sorry to say that but your solution doesn't work on leetcode. but however explanation is great
@drishtipoddar9065
@drishtipoddar9065 4 жыл бұрын
Sir has mentioned that he is assuming the length to be the same. Maybe the program in leetcode has different lengths of arrays of inorder and preorder. Or maybe leetcode has repetitive inputs.
@diveshrajput572
@diveshrajput572 4 жыл бұрын
@@drishtipoddar9065 or may be he don't know how to type on keyboard.
@drishtipoddar9065
@drishtipoddar9065 4 жыл бұрын
Divesh rajput or maybe u don’t know the English language to frame a correct sentence
@aneesaziz3611
@aneesaziz3611 4 жыл бұрын
left preorder end computation not clear to me. can anybody plz explain? Thanks
@shethnisarg3049
@shethnisarg3049 6 жыл бұрын
just one word WOW!
@karthikk5895
@karthikk5895 6 жыл бұрын
What's the running time complexity of this algorithm?
@ankitsharma8221
@ankitsharma8221 5 жыл бұрын
O(n * n)
@Sauravgpt34
@Sauravgpt34 4 жыл бұрын
Thank you so much sir. How can get your complete course?
@ajaytyagi3018
@ajaytyagi3018 4 жыл бұрын
nice
@ritikgupta5240
@ritikgupta5240 4 жыл бұрын
print tree function kaise banaya ?
@alphabeta6272
@alphabeta6272 3 жыл бұрын
satisfaction
@4Dgenius
@4Dgenius 4 жыл бұрын
What language is it? Half english half Hindi?
@kunalkumarshrivastava
@kunalkumarshrivastava 4 жыл бұрын
yes
@tanmayjain5821
@tanmayjain5821 4 жыл бұрын
Noice
@yayyy5866
@yayyy5866 4 жыл бұрын
not a good solution ....not sagtisf time complexity
@MustafaKHAN-sw1xb
@MustafaKHAN-sw1xb 6 жыл бұрын
Sir mujhai competitive programming ka course karna hai
@Sanjeev.Network
@Sanjeev.Network 6 жыл бұрын
Yes, Coding Ninjas Do have competitive programming Online Classes. Taught by STANFORD and FACEBOOK, AMAZON, MICROSOFT EMPLOYEE. You can go to the below link and have discount of Rupees 1200/- codingninjas.in/app/invite/ZVUAQ
@Sanjeev.Network
@Sanjeev.Network 6 жыл бұрын
Yes, Coding Ninjas Do have competitive programming Online Classes. Taught by STANFORD and FACEBOOK, AMAZON, MICROSOFT EMPLOYEE. You can go to the below link and have discount of Rupees 1200/- codingninjas.in/app/invite/ZVUAQ
@aryanpathak9232
@aryanpathak9232 3 жыл бұрын
Awesome Explanation
How to Construct a Binary Tree in Java?
7:38
Coding Ninjas
Рет қаралды 24 М.
How to Find the Diameter Of Binary Tree(Better Approach) - C++
18:25
If people acted like cats 🙀😹 LeoNata family #shorts
00:22
LeoNata Family
Рет қаралды 23 МЛН
Creative Justice at the Checkout: Bananas and Eggs Showdown #shorts
00:18
Fabiosa Best Lifehacks
Рет қаралды 6 МЛН
How Much Tape To Stop A Lamborghini?
00:15
MrBeast
Рет қаралды 233 МЛН
Turn Off the Vacum And Sit Back and Laugh 🤣
00:34
SKITSFUL
Рет қаралды 7 МЛН
How to Construct Binary Tree in C++ ?
8:09
Coding Ninjas
Рет қаралды 26 М.
Diameter Of Binary Tree(Better Approach) - JAVA
15:01
Coding Ninjas
Рет қаралды 23 М.
7 Common Excel Mistakes You HAVE to Fix Today!
11:39
MyOnlineTrainingHub
Рет қаралды 21 М.
Best Algorithms for Programming Interviews: Huffman Algorithm.
19:52
Interview Problem: How to Build A Segment Tree?
16:13
Coding Ninjas
Рет қаралды 23 М.
Strongly Connected Components: Kosarajus Algorithm
19:25
Coding Ninjas
Рет қаралды 15 М.
PART - 1 : How I cracked SAP Interview? With Notes
6:23
Kareena
Рет қаралды 3,7 М.
If people acted like cats 🙀😹 LeoNata family #shorts
00:22
LeoNata Family
Рет қаралды 23 МЛН