Abdul Sir, I work for Microsoft in Redmond Seattle. I have 15 years industry experience, but I have never seen such crisp explanation of DP. Chained Matrix mult and this one with OST, is one of the best explanation videos on RUclips ever,
Hi , I am Saptarshi Rudra from India. I have a passion for working at Microsoft and a good grasp over DS and Algo and years of Software Development experience. I would really love if someone like you recommend me for a Software Developer / Engineer position. I have applied for these positions for the past 2 months, but yet to receive any call. So I would be extremely grateful if you recommend me. My full name is Saptarshi Rudra. Thanks.
@@atharvameher5880 please inform yourself before rashly posting a comment. Microsoft, Google and Amazon have local offices in the country in many states. Where is even your statement coming from!!
For those who don't understand the formula here is an explanation. It took a while for me too. Everytime you try to add the nth node on to a tree with n - 1 nodes, you have to pick a root point k and k - 1 nodes on the left tree, n - k nodes on the right tree. k - 1 and n - k each as INDIVIDUAL TREE should already be calculated previously according to the table, so you just have to find where those are on the table which is at c[0, k - 1] and c[k, n] Look now we have the rank of 2 trees and 1 single root, to push the left or right tree into a sub tree you need add one level on each of their node therefore add the entire weight of the tree The combined tree with k as root have: Rank(k) = Rank(left) + Rank(left) + weight(left) + weight(right) + weight(root) = Rank(left) + Rank(right) + weight(0 - n) = c[0, k-1] + c[k, n] + w(0, n)
i never hated any subject until i encountered Design and analysis of algorithms. also my university prof who makes the ppr so difficult and calculative.
It's relatively impossible to not understand what you convey . You are a legend ❤️. For all concepts in DAA i watch your videos . First time when I watched your video on this concept i couldn't understand as I was bit hurried due to upcoming test in an hour .😁😁 But now here I am again for the second time , watching this concept and understanding it properly . Note : for those of you who don't understand Abdul Bari sir , maybe you need to be relaxed and give some time to the video without any hurry . This is specially for those who come here an hour before exam 😂.
Abdul Bari Sir (love) for ur passion to teach us, with every new video you raise the bar even higher, I cannot thank you enough for this, hope u always stay healthy & wealthy :)
Abdul Sir, I am a 5 year experienced Software Engineer. I have Google interview coming up on June 10th. So I started watching your algorithm videos and reached this lecture. Although I found this playlist very late after referring to a number of resources, your videos are very effective and easy to understand..
Formula = c[I,j]={c[I,k]+c[k+1,j]+weight} Where k values are C[0,3] then k values are 0,1,2 Then I=0 and j=3 Substitute the values C[0,0]+C[1,3]+12 Hope it helps
@14:45 how are you getting the values using formula.....and also please tell how u calculated it in brief? Sir.....thank you.....I am finding it very difficult to understand this part.
Your explanation is great, but I was kind of confused about the 9:05, when you conduct j-i, I do not understand the meaning of j-i, and the meaning of l, what that expression stands for? and why we use 1 represent 10, 2 represent 20 and so on, if we use 4 represent 10 ,it is a different story.
13:30...Formula is C[i,j]=C[i,k-1]+C[k,j]+w[i,j]... i and j value and weight.. u know..now value of K..😆😆 For value of k. 10 is 1st so key no. of 10 is..k=1... 20 is 2nd so key no. of 20 is.k=2.. 30 is 3rd so key no of 30 is..k=3.. 40 is 4th so key no of 40 is k=4.. ..Now to select k ..u have to take root node key no..if ur root node is 10 then k=1..if ur root node is 20 then k=2..so on.. C[0,2] that first 2 numbers.. 10 and 20.. C[i,j]=C[i,k-1]+C[k,j]+w[i,j] FOR 10..K=1.. C[0,2]={C[0,0]+c[1,2]}+w[0,2] =0+2+4+2 =8 FOR 20..K=2.. C[0,2]=C[0,1]+C[2,2]+w[i,j] =4+0+4+2 =10.. U know which one to select :)
before you start filling the matrix , please mention what is the behind filling like that ..for example.....telling that j-i=1 but what is the motive of doing that because when i will get a problem i will not start thinking like first i-j=1 then i-j=2 ..in fact i will start thinking it practically why i need to do that then converting it into matrix .l have seen you explaining like this before also . al though everytime i am able to figure out why it is needed bt still start with the motive why we need to proceed like that.
The video discusses the concept of an optimal binary search tree, where the keys have different search frequencies. The dynamic programming approach is used to find the optimal tree organization that minimizes the total search cost. Key moments: 00:00 Binary search trees are efficient for searching keys with a time complexity of log n. Different binary search trees can be formed for a given set of keys, impacting the search cost. -Binary search trees provide efficient key searching with a time complexity of log n, based on the tree height. -Different binary search trees can be formed for a set of keys, affecting the number of comparisons needed for key search, leading to a balanced binary search tree. -Optimal binary search trees consider the frequency of key searches, prioritizing more frequently searched keys, impacting the overall search efficiency. 06:04 The video discusses optimizing binary search trees based on key frequencies. Dynamic programming is used to find the optimal organization for keys with different frequencies. -Explanation of how to determine the optimal binary search tree organization based on key frequencies using dynamic programming. -Detailed step-by-step process of filling values in a table to calculate the cost of different binary search tree organizations. 12:43 The video explains a process of finding the minimum cost of forming a binary search tree using dynamic programming and frequency values. It demonstrates selecting keys, calculating costs, and determining the optimal arrangement of keys. -Demonstrating the calculation of costs and comparisons for different key selections in forming a binary search tree. -Exploring the process of selecting keys and frequencies to determine the optimal arrangement for minimizing the cost of the binary search tree. -Illustrating the expansion of the process to consider three keys at a time to further optimize the arrangement and minimize the cost of the binary search tree. 19:18 The video discusses the concept of finding the optimal cost of a binary search tree using a formula based on frequencies and weights of keys. It demonstrates the calculation process step by step. -Calculation of optimal cost for different key possibilities using a formula based on frequencies and weights. -Determining the root key for optimal cost calculation and selecting the minimum cost among different possibilities. -Expanding the analysis to consider more keys and calculating the optimal cost for a larger set of keys in a binary search tree. 27:40 The video explains the concept of an optimal binary search tree using a formula to minimize the cost of searching based on frequency. It demonstrates how to apply the formula for optimal tree construction. -Explanation of the concept of an optimal binary search tree and its importance in minimizing search costs based on frequency of search. -Demonstration of the formula for constructing an optimal binary search tree to minimize search costs and how to apply it effectively.
Hi Sir, Really Informative, great use of examples . I am able to grasp the content so well.. Just a quick suggestion, could you also device the algorithm or pseudo-code at the end, to help us get a more generalized view on solving the problem.
Sir, first of all, thank you very much for the wonderful content. Sir, it looks like you have not covered some contents from Algorithms, which is generally part of the syllabus. So I request you to cover the following contents also: Lower-Bound Theory: Introduction to Algebraic problems, Introduction to lower bounds, Comparison Trees,Techniques for Algebraic problems, Some Lower Bounds on Parallel Computation
Please clarify my query.. 1. when j-i =1 -> Here we calculated the cost for all the 4 keys (10, 20, 30 40) 2. when j-i =2 -> Why do we only take these 3 combination (10, 20) (20, 30) (30, 40) only ?? 3. As we already know to select 2 keys out for keys is 4C2 => 6 4. So why we dont consider (10, 40) (10, 30) (20 40) 5. |||y for 3 pairs and so on ?? Could you please clarify this point .. ?? Thanks in Advance..
a quick shortcut for exam or observation just add the corresponding element from the row and column u are supposed to find.... for example u want to find c[0,3]=(0,0)+(3,1),(0,1)+(3,2),(0,2)+(3,3) hope u found the pattern...
Excuse sir! First of all great explanation but I didn't understand the last part where you construct the tree. I'm unable to understand the way you are diving the branches.
Sir, why are we adding the weight of all the keys in the formula?.....How is it related to the formula and the BST if we consider 2 nodes BST or 3 nodes BST?
Formula = c[I,j]={c[I,k]+c[k+1,j]+weight} Where k values are C[0,3] then k values are 0,1,2 Then I=0 and j=3 Substitute the values C[0,0]+C[1,3]+12 Hope it helps
See when u r watching this for first time, the formula used can be confusing, so either u try to think on your own, that what the formula can be, based on observations or simply skip to the end at 29:30 and note the formula and then understand. But I won't prefer latter way as it the essence of dynamic programming is to find a formula. So don't do this unless you are absolutely clueless.
I observe one thing in the above problem that consider the frequencies in descending order and then form binary search tree. We get answer(you need cost then find the cost from tree)
sir, your explanation was great but why did you have to hide the formula till the end? I had to wrack my brain trying to derive it manually understand it :')
Formula = c[I,j]={c[I,k]+c[k+1,j]+weight} Where k values are C[0,3] then k values are 0,1,2 Then I=0 and j=3 Substitute the values C[0,0]+C[1,3]+12 Hope it helps
this video is little confusing to me. it is not clear to me , how are we getting the formulas. But as an alternate solution, we could have sorted the input as per the frequency and then inserted one by one into a BST ?
Thank you, Sir 🙏
Dear, check the amount once. I think, it’s by mistake.
Bro?? 8900?? Was it by mistake or what?👀
@@abdul_bari :) sir u r best
Wtf😂😂😂
Abdul Sir, I work for Microsoft in Redmond Seattle. I have 15 years industry experience, but I have never seen such crisp explanation of DP. Chained Matrix mult and this one with OST, is one of the best explanation videos on RUclips ever,
Hi , I am Saptarshi Rudra from India. I have a passion for working at Microsoft and a good grasp over DS and Algo and years of Software Development experience. I would really love if someone like you recommend me for a Software Developer / Engineer position. I have applied for these positions for the past 2 months, but yet to receive any call. So I would be extremely grateful if you recommend me.
My full name is Saptarshi Rudra.
Thanks.
@@Akaash449 waste of time bro he might have changed his mail I'd so only no response
he told the formula to fill the table after filling the table..all the time i was thinking how he is filling.....so how can you say this is best......
@@Akaash449 Why do people wanna work in foreign I don't get it? You guys don't like it here? Proximity to family and friends don't matter to you?
@@atharvameher5880 please inform yourself before rashly posting a comment. Microsoft, Google and Amazon have local offices in the country in many states. Where is even your statement coming from!!
You can see. He teaches with love, reveals everything that needs to be mastered. Thanks Abdul. You are the best.
enna sollu thaliva
For those who don't understand the formula here is an explanation. It took a while for me too.
Everytime you try to add the nth node on to a tree with n - 1 nodes, you have to pick a root point k and k - 1 nodes on the left tree, n - k nodes on the right tree.
k - 1 and n - k each as INDIVIDUAL TREE should already be calculated previously according to the table, so you just have to find where those are on the table which is at c[0, k - 1] and c[k, n]
Look now we have the rank of 2 trees and 1 single root, to push the left or right tree into a sub tree you need add one level on each of their node therefore add the entire weight of the tree
The combined tree with k as root have:
Rank(k) = Rank(left) + Rank(left) + weight(left) + weight(right) + weight(root) = Rank(left) + Rank(right) + weight(0 - n)
= c[0, k-1] + c[k, n] + w(0, n)
This is an application of knuth optimization for Dynamic Programming
Thanks!
nice bro but I did not understand anything.
@@mfaraday4044 😂🤙
Well explained :)
For the recurrence relation, it would be more appropriate to write C[i, j] (for i < j) as the min {C[i, k-1] + C[k+1, j]} + w(i, j) where i
In 6:35 it was actually 22.Also thanks for a great video!
You are a life saver, sir! Honestly, you make this subject look so easy and fun! Hooked.
@7:46 when he said: this is the optimal binary search tree! I made dua for this teacher.
tomorrow is my viva and i am here that makes u life saver thankuh so much sir
What an Explanation!!😮
Clear and clarity
He need best lecturer award❤
i never hated any subject until i encountered Design and analysis of algorithms. also my university prof who makes the ppr so difficult and calculative.
It's relatively impossible to not understand what you convey . You are a legend ❤️.
For all concepts in DAA i watch your videos .
First time when I watched your video on this concept i couldn't understand as I was bit hurried due to upcoming test in an hour .😁😁
But now here I am again for the second time , watching this concept and understanding it properly .
Note : for those of you who don't understand Abdul Bari sir , maybe you need to be relaxed and give some time to the video without any hurry . This is specially for those who come here an hour before exam 😂.
How many engineers out here, give a like.
Sir I am from GGSIPU (Delhi), Today i hava ADA exam and I prepared only your videos, and kudos to your playlist thanku so much!
Kesa gya bhai ?
@@ankushgarg2188 Rula diya yaar, difficult exam aaya tha!
@@abdul_bari Sir 100%, these videos contains even more, thanks sir for replying, you are legend, and god for us!
@@abdul_bari Sir...ur videos are very helpful 😇 ur way of teaching, deep knowledge of the this subject 👏
Lots of love and huge respect 😇
From🇮🇳
You just saved my life in a Data Structure exam, thaks very much 😍😍😍
Wt a teaching sir..... Really no one can say like u sir..... With out disturbance....super sirrr
first see the formla and then see it will be of great help 29:29
such an amazing explanation of optimal binary search trees!!! thank you so much for making this video!
Abdul Bari Sir (love) for ur passion to teach us, with every new video you raise the bar even higher,
I cannot thank you enough for this, hope u always stay healthy & wealthy :)
Great video so easy to understand , clear pronunciation and clear handwriting
Abdul Sir, I am a 5 year experienced Software Engineer. I have Google interview coming up on June 10th. So I started watching your algorithm videos and reached this lecture. Although I found this playlist very late after referring to a number of resources, your videos are very effective and easy to understand..
How did you do?
The technical rounds went well. The process is not complete yet. I will share the result soon.
@@coolone5561 I hope you get it, good luck! 🍀💪
@@coolone5561 how is it going its been 2 months
@@coolone5561 ?? update
Formula = c[I,j]={c[I,k]+c[k+1,j]+weight}
Where k values are
C[0,3] then k values are 0,1,2
Then I=0 and j=3
Substitute the values
C[0,0]+C[1,3]+12
Hope it helps
Why did u only took k=0,but k can be 1,2 also??
@@naveen_kotha That was just a part of that example. Yes k can also be 1 and 2
Thanks for formula
You are a wonderful teacher. Thank you, so much for helping me to understand these concepts in an easy way.
I have gone through few video lectures of ur's sir..Very qualitative, easily understandable..
Thank you.. :-)
Playlist is matching VTU syllabus..
+Abdul Bari Yeah sir.. Visvesvaraya Technological University..
Exams for my students will be in Jun-Jul
Hemanth on fire 🔥🔥🔥
😂
😂
6:32 How it came 18?? It will be 22.. Right?
yeah even i was shocked, but I guess its a minor mistake
yeah, I was like wtf happened haha
yeah 15+3+4=22,Sir unexpectedly did a mistake.
Yaa right
Sir, I have to thank you a lot for saving me. Great content and explanation! Please keep up the good work!
Thank you Sir for the video. The effort you put in making these videos is really commendable.
@14:45 how are you getting the values using formula.....and also please tell how u calculated it in brief? Sir.....thank you.....I am finding it very difficult to understand this part.
same problem
if any one knows pls replay
Your explanation is great, but I was kind of confused about the 9:05, when you conduct j-i, I do not understand the meaning of j-i, and the meaning of l, what that expression stands for? and why we use 1 represent 10, 2 represent 20 and so on, if we use 4 represent 10 ,it is a different story.
13:30...Formula is C[i,j]=C[i,k-1]+C[k,j]+w[i,j]... i and j value and weight.. u know..now value of K..😆😆
For value of k.
10 is 1st so key no. of 10 is..k=1...
20 is 2nd so key no. of 20 is.k=2..
30 is 3rd so key no of 30 is..k=3..
40 is 4th so key no of 40 is k=4..
..Now to select k ..u have to take root node key no..if ur root node is 10 then k=1..if ur root node is 20 then k=2..so on..
C[0,2] that first 2 numbers..
10 and 20..
C[i,j]=C[i,k-1]+C[k,j]+w[i,j]
FOR 10..K=1..
C[0,2]={C[0,0]+c[1,2]}+w[0,2]
=0+2+4+2
=8
FOR 20..K=2..
C[0,2]=C[0,1]+C[2,2]+w[i,j]
=4+0+4+2
=10..
U know which one to select :)
U cheater cock copied from ChatGPT
u copied from chat gpt u cheater , u mother father no manners , this not chlid play
Kiddo that time no chatgpt
We love you ❤😊, sir
The video is like explaining the steps involved but i need the reason behind why we are doing ot in that way?
read the book h.cormen for why's of everything
Check leetcode site
true mann. he is just writing the steps involved
14:45 top moment, thank you
ABDUL BARI I LOVE YOU SO MUCH
Sir you have explained the concepts so well.
Your teaching is great sir
before you start filling the matrix , please mention what is the behind filling like that ..for example.....telling that j-i=1 but what is the motive of doing that because when i will get a problem i will not start thinking like first i-j=1 then i-j=2 ..in fact i will start thinking it practically why i need to do that then converting it into matrix .l have seen you explaining like this before also . al though everytime i am able to figure out why it is needed bt still start with the motive why we need to proceed like that.
I did'nt Understand this really
No one can save you bro. Are you passed or not ? 😅😅
@@yashwanthseeram3488 stop flexing
Go to next lecture
ur videos r great sir...thank u for saving us...gitam students love u a lot
Thank you very much. You are a genius. 👍👍🔝🔝🙏🙏👌👌
A very good explanation. Thank you.
Thank you sir it's a very understandable example 🙏🙏
6:32 answer is by adding the values 22
Ya i also noticed
Very good teaching 😊
wonderfully taught.
but u should have explained formula in the start and not revealed it at the end.
that wud have made it better
Totally agree, had me scratching my head the whole time.
Thank you sir, for your great explanation. 🙏🙏
Sir's explanation is great, i just love his explaining techniques.
I would've given up my final exams if you were not here.
I like ur way of teaching... Ur teaching is very clear sir about the topic
great video! Explain things so well!
Sir why are we checking "l = j-i=0" 9:00 ?
First you have to see the formula to understand the problem
29:31
If helped
Like👍
You are truly a saviour,
Tysm.
The video discusses the concept of an optimal binary search tree, where the keys have different search frequencies. The dynamic programming approach is used to find the optimal tree organization that minimizes the total search cost.
Key moments:
00:00 Binary search trees are efficient for searching keys with a time complexity of log n. Different binary search trees can be formed for a given set of keys, impacting the search cost.
-Binary search trees provide efficient key searching with a time complexity of log n, based on the tree height.
-Different binary search trees can be formed for a set of keys, affecting the number of comparisons needed for key search, leading to a balanced binary search tree.
-Optimal binary search trees consider the frequency of key searches, prioritizing more frequently searched keys, impacting the overall search efficiency.
06:04 The video discusses optimizing binary search trees based on key frequencies. Dynamic programming is used to find the optimal organization for keys with different frequencies.
-Explanation of how to determine the optimal binary search tree organization based on key frequencies using dynamic programming.
-Detailed step-by-step process of filling values in a table to calculate the cost of different binary search tree organizations.
12:43 The video explains a process of finding the minimum cost of forming a binary search tree using dynamic programming and frequency values. It demonstrates selecting keys, calculating costs, and determining the optimal arrangement of keys.
-Demonstrating the calculation of costs and comparisons for different key selections in forming a binary search tree.
-Exploring the process of selecting keys and frequencies to determine the optimal arrangement for minimizing the cost of the binary search tree.
-Illustrating the expansion of the process to consider three keys at a time to further optimize the arrangement and minimize the cost of the binary search tree.
19:18 The video discusses the concept of finding the optimal cost of a binary search tree using a formula based on frequencies and weights of keys. It demonstrates the calculation process step by step.
-Calculation of optimal cost for different key possibilities using a formula based on frequencies and weights.
-Determining the root key for optimal cost calculation and selecting the minimum cost among different possibilities.
-Expanding the analysis to consider more keys and calculating the optimal cost for a larger set of keys in a binary search tree.
27:40 The video explains the concept of an optimal binary search tree using a formula to minimize the cost of searching based on frequency. It demonstrates how to apply the formula for optimal tree construction.
-Explanation of the concept of an optimal binary search tree and its importance in minimizing search costs based on frequency of search.
-Demonstration of the formula for constructing an optimal binary search tree to minimize search costs and how to apply it effectively.
sir,could you explain how to generate a tree from the data at the end?
Hi Sir,
Really Informative, great use of examples . I am able to grasp the content so well..
Just a quick suggestion, could you also device the algorithm or pseudo-code at the end, to help us get a more generalized view on solving the problem.
Maybe next time. Or Sir u can add like a Part-2 for this video
Sir, first of all, thank you very much for the wonderful content.
Sir, it looks like you have not covered some contents from Algorithms, which is generally part of the syllabus. So I request you to cover the following contents also:
Lower-Bound Theory:
Introduction to Algebraic problems, Introduction to lower bounds, Comparison Trees,Techniques for Algebraic problems, Some Lower Bounds on Parallel Computation
Thank you very much Sir.
Please clarify my query..
1. when j-i =1 -> Here we calculated the cost for all the 4 keys (10, 20, 30 40)
2. when j-i =2 -> Why do we only take these 3 combination (10, 20) (20, 30) (30, 40) only ??
3. As we already know to select 2 keys out for keys is 4C2 => 6
4. So why we dont consider (10, 40) (10, 30) (20 40)
5. |||y for 3 pairs and so on ??
Could you please clarify this point .. ?? Thanks in Advance..
Sir, Thank you so much for the video. Best explanation I have seen. Expecting more videos.
Sir , I had a dought that what if the values of q1,q2 .....are not given 🤔🤔🤔🤔🤔🤔🤔🤔
Sir which ide you use for coding?
If you are a faculty in our college we always rock in the exams Your lectures are Superb sir 👏👏👏👏👏👏👏🙏🙏🙏🙏
a quick shortcut for exam or observation just add the corresponding element from the row and column u are supposed to find....
for example u want to find
c[0,3]=(0,0)+(3,1),(0,1)+(3,2),(0,2)+(3,3) hope u found the pattern...
Excuse sir! First of all great explanation but I didn't understand the last part where you construct the tree. I'm unable to understand the way you are diving the branches.
Big Thanks sir ......you are awesome.
For this to work keys should be in sorted order or not?
This is the best explanation I have found on You tube thanks
Nice explanation sir aapke sabhi videos bahot hi ache se samjh ate hain thanks
It's some what difficult problem to solve but this video made it easy for implementing
Yeah I saw it quite easier
Sir, why are we adding the weight of all the keys in the formula?.....How is it related to the formula and the BST if we consider 2 nodes BST or 3 nodes BST?
I want to salute u sir for your efforts in making such amazing videos. It made all my concepts clear. Thank you sir
Can anyone explain from 27:45
How he created the tree
28:11 How did you get r[0,2] and r[3,4] ??
For 0,2 take less root value than actual root as 1 previous was 3
For 3,4 take greater root than actual root as 4 previous was 3
@@mr.devanand3369 explain properly
root node is r[i,j]=k;
left node is r[i,k-1];
right node is r[k,j];
@@DineshKumar-jx2dc thanks fam
Formula = c[I,j]={c[I,k]+c[k+1,j]+weight}
Where k values are
C[0,3] then k values are 0,1,2
Then I=0 and j=3
Substitute the values
C[0,0]+C[1,3]+12
Hope it helps
14:38 u never said how you took the numbers in the brackets c[0,0]+c[1,2]+w[0,2] .... why did u take 0,0 and 1,2 in the brackets
Because of table
sir the first one for frequenct check the count would be 22 not 18
6:33 15+4+3 .. 18 😂
I love his lectures by the way.
just wow! it was great...
Thanks for telling us how the formula works :)))))))
how you have chosen the child of r(0,4) are r(0,2) and r(3,4). plz explain
because as the matrix he created , the root for r(0,4) is 3...thus, k =3 here...
so the child will become for c[i,j] ---> c[i,k-1] and c[k,j]
@@aayushkumar5361 thanks dude, saved my time!!!
This is great video but in this video 6: 29 part of video is some mistake cost of 1st tree is 22 due to given frequency but you write 18
This video is very helpful..Thank you so much sir.It is really easy to understand..
See when u r watching this for first time, the formula used can be confusing, so either u try to think on your own, that what the formula can be, based on observations or simply skip to the end at 29:30 and note the formula and then understand. But I won't prefer latter way as it the essence of dynamic programming is to find a formula. So don't do this unless you are absolutely clueless.
Sir which books you have referred to gain this much knowledge ❤️
thank you sir for your better techer thank you a lot sir
Thank you so much for the explanation! It helped me a lot!
I observe one thing in the above problem that consider the frequencies in descending order and then form binary search tree. We get answer(you need cost then find the cost from tree)
Very confusing, but watching till end made it clear
Ok sir, got it :-)
sir, your explanation was great but why did you have to hide the formula till the end? I had to wrack my brain trying to derive it manually understand it :')
Sir, at 6:35 the answer of the tree is 21.... It's not 18
i have doubt in the formula i didn"t understood the formula
for those who are confused about the formula he has given the formula at the last of the video
13:45 how does c(0,0) c(1,2) came pls help
@Virendra Negistill that part is unclear
In range of (0,2)
Two value are coming 1 and 2
So possible value= MIN ((C(0,1)+C(2,2)+C(0,0)+C(1,2)))
+W(0,2)
= ANSWER
HOPE U UNDERSTAND
Formula = c[I,j]={c[I,k]+c[k+1,j]+weight}
Where k values are
C[0,3] then k values are 0,1,2
Then I=0 and j=3
Substitute the values
C[0,0]+C[1,3]+12
Hope it helps
@@sandeepkumar-ty3kt values of k shouldn't include i . Then how come the values of k are 0,1,2?
this video is little confusing to me. it is not clear to me , how are we getting the formulas.
But as an alternate solution, we could have sorted the input as per the frequency and then inserted one by one into a BST ?
pradip biswas i got same prblm little bit confusion how to make formula 😇
its not clear through video without formula ..... it might better if you wrote that before applying
Nice explaining sir
At 15:03 how did we get c(0,1)+c(2,2)
bcoz 2 is the key
dunno y, you didn't told the formula used in starting of the explanation, I was blank what which formula u r using :(
at 27:57 from where we got (0,2 ) and (3,4)
bro the value of key was 3 so by implying formula C[i,K-1] and C[k,j]
We can also directly generate tree by taking max frequency key as an root.
Does this work all the time?
Btw tq for that, 😅
Thank u so much sir. How c(0,0) in the first step i didn't understand