That is THE best explanation for this problem. For some reason I really struggled with this one and watched a lot of guides on youtube/leetcode discussion sessions, but could not get those. Here, after just conceptual explanation I stopped the video and was able to code solution on my own. Thank you SO much Tushar, great explanation and teaching, keep it up!
@m0rtale1955 жыл бұрын
Great explanation! Helped me through a homework question asking for a similar algorithm.
@partheshsoni64213 жыл бұрын
You are the best DSA content providing channel. Thanks a lot!
@santhoshmedide52793 жыл бұрын
I saw a couple videos and explanations for this question so far and this's been the best one out there.
@pl57785 жыл бұрын
this is the best explanation on youtube, thanks for this!
@prodev74019 жыл бұрын
GO GO Tushar :))) the best channel
@rajeshkumarjha007raj6 жыл бұрын
Hello friends. Coding karlo. Jokes apart, i appreciate your efforts, you'er a fabulous teacher. Keep growing.
@AK-fk8jv6 жыл бұрын
haha lol
@fatihgul40273 жыл бұрын
Great explanation
@sameergirkar6 жыл бұрын
Very good video to understand this problem. Thanks Tushar.
@vinittodai9112 жыл бұрын
Awesomest Explanation!
@lambdastudies34093 жыл бұрын
What a legend sir! Salute and thanks
@chrisogonas3 жыл бұрын
Well illustrated. Thanks
@treksis3 жыл бұрын
still the best. video recorded in 2015.
@JJ-Bond5 жыл бұрын
but how tho? what are those two for loops from? It seems like a huge jump from the algo to the code. where's that thought process?
@bluemoonsri4 жыл бұрын
yes, he should have spent more time explaining the code
@ronki183 жыл бұрын
lol, guess you are just too dumb
@191sri6 жыл бұрын
Hi Tushar, Can you help to solve this kind of problem Question : Given a set of N numbers [1,N], partition them into 2 disjoint subsets based on a set of K queries. Each query is of the type (n1, n2) where n1 and n2 are distinct numbers from the set and n1 and n2 belong to opposite subsets. Example: Input: Input: N = 4 K = [(1, 2), (1, 3), (2, 4)] Output: Set 1 : (1,4) Set 2 : (2,3)
@create_space8124 жыл бұрын
very clear! thank you Tushar!
@Yzhang2507 жыл бұрын
Great great explanation of the answer, can you talk more about catalan number?
@SivaBhargavRavella4 жыл бұрын
good explanation.
@ramkumarps1856 жыл бұрын
How did u arrive at the first and second for loop conditions and the formula T[j] * T[i-j-1] ? I could understand how the multiply works though but cannot understand the generalization here.
@executer775 жыл бұрын
(2n)!/(n+1)!*n! ..............same here bro couldn't get the generalization and the formula as well.
@vigneshnaik71585 жыл бұрын
Both left subtree and right subtree are linked. So if the number of structures of left subtree is x and number of right subtree structures is y. Then unique trees formed will be x*y. Suppose x=2 and y=2. Then I'll be having 4 different and unique tree structures ryt.
@bharathateja27975 жыл бұрын
very nice explanation thanks
@ameyapatil11394 жыл бұрын
very well explained.
@jeetgandhi56294 жыл бұрын
Amazing Solution! Thank you, sir!
@mubiale40604 жыл бұрын
Thanks, its clear to understand
@hjkc60005 жыл бұрын
Google should hire this man
@DheerajKumarBarnwal5 жыл бұрын
He is an Engineering manager at Apple.
@m16biswas454 жыл бұрын
thank you so much.......
@prakashhiranandani5 жыл бұрын
Thank You Sir!!! great help in understanding DP problems :) Keep it up!!!
@shobhitranjan39574 жыл бұрын
brilliant!
@noornoorjahan42612 жыл бұрын
you can simply use this formula( 2n! / (n+1)! X n!) and substitute the n value simple.
@siaw00005 жыл бұрын
Very nice video! I've been trying to find answers to this question, but most sites I've come across only offer the answer with no explanation how they got there.
@RohanKumar-vx5sb6 жыл бұрын
Tushar!!! Cant thank enough!!
@ashwinsubu55215 жыл бұрын
Perfect explanation. What if you wanna display all the possible BSTs too? How would you handle that? Do you have a video for that?
@vikrant46665 жыл бұрын
he's doing job in apple now , he dont have time for ur shit now
@herbertzhou25983 жыл бұрын
awesome
@arnaudcortisse10414 жыл бұрын
"BST is a tree where every node has two child" --> I stopped there...
@windmaomao4 жыл бұрын
Well, you have to have some tolerance for common sense, which might not be mathematically accurate.
@suhanshupatel92044 жыл бұрын
Thanku you!!
@swagatzeher3 жыл бұрын
Superb explanation as always ! By the way I like your hairstyle :)
@AnuragGarg-dexter9 жыл бұрын
Great explanation. I have a doubt though. What happens if there are duplicate elements?
@hardikrana26497 жыл бұрын
BST never have duplicates
@praffulmittal286 жыл бұрын
Anurag Garg bro their is no duplicate item in bst.....
@skootergofast1236 жыл бұрын
its 1 to n....so no duplicates
@lavishgarg42745 жыл бұрын
There are no duplicate element in the BST
@b9944236 Жыл бұрын
Best
@sarora84752 жыл бұрын
wow thanks!
@Rajuvlogs91823 жыл бұрын
initially ,there was only one tree with value 2.find the total number of trees present after cutting k trees .input:1,input:5 and output :3 c++ program Pls tell me
@SnehasishGhoshSg5 жыл бұрын
Awesome Thhuusar..
@konstantinshalnev21736 жыл бұрын
Brilliant. Thanks.
@jinyi03136 жыл бұрын
how to calculate possible triangle in binary tree. example if i insert 7 points it will return 4 triangle. thank you for asnwer
@pranaytanniru77645 жыл бұрын
Thank you
@kenrivkenriv56454 жыл бұрын
pretty good!
@ranjithcheguri4 жыл бұрын
Thanks man.
@deepakpoojari90194 жыл бұрын
great thanks man!!!!
@evgeny15554 жыл бұрын
What if some nodes have the same keys? For example 1, 1, 1, 2, 2, 2
@ashishjaiswal42074 жыл бұрын
we will on the left node
@ІванМанчур-е7з4 жыл бұрын
This is not possible - every key in BST must be unique
@artempar4 жыл бұрын
I tried both solutions that provided - and they both return wrong count. For n = 3 it returns 12, not 5.
@harishchandramohan18235 жыл бұрын
If given numbers are 7,9,11 . There are 6 different BST possible. But u said for 3 elements only 5 bst possible how?
@SHASHANKRUSTAGII5 жыл бұрын
This was in my test series
@11m08 жыл бұрын
Could u explain why we multiply instead of adding when a certain number is the root like at 4:53?
@abhishekpandey44277 жыл бұрын
Permutations and combinations is the chapter you should study
@Majorchaoss4 жыл бұрын
multiplication is considering both possibilities happen together, addition implies either of the possibilities can happen.
@umarazahid61834 жыл бұрын
what are the ways to search a nuber from a tree?
@Atpugtihsrah3 жыл бұрын
KZbin generated caption right said "Hello friends, my name is too sharp ... " 😀
@viraj_singh7 жыл бұрын
great
@shairafghan44706 жыл бұрын
R/Sir Please help me in completing my assignment Q1) what is running time of of algorithm. First write the recurrence equation and then find its complexity function(int n) { if (n
@koustavdas65854 жыл бұрын
It is a catalan number. But how it come. Please derive the general rule
@shoebmoin106 жыл бұрын
This can be done simply by finding the catalan number.
@meganlee58977 жыл бұрын
this is Catalan number.
@lavishgarg42745 жыл бұрын
Yes this can be implemented directly by formula, but understanding the app. is important, ie from where that formula has actually derived
@pseudonym0336 жыл бұрын
miaoooooo I love Indian nerds
@nehasehta77628 жыл бұрын
pl explain no of binary trees possible with n unlabeled or labeled nodes
If we give n=384 it is giving wrong answer.. could anyone plz check
@virinchisavanapelli58984 жыл бұрын
why t[0]=1?
@vaibhavchhabra8008 жыл бұрын
+Tushar Roy I don't think it is a question of dynamic programming n there is a direct formula for this question Proof - www.geeksforgeeks.org/g-fact-18/
@easynet1yt8 жыл бұрын
+Tushar Roy hahah..Made my day !!! I was just mugging up this formula. Your comment made me to watch whole video once again. Thanks for videos !! Subscribed !! :D