Even in 2021 when there are so many videos/playlists available on TH-cam, it's hard to find this much easily understandable and quality content on DSA. 😍
@@CuriousAnonDev Unfortunately one of the two people who started this channel is no more.He died in an accident in US and the other person wasnt in right state of mind for few days.I hope they r both fine in their own worlds now ....lots of love to their work
The number of lives this channel has touched is far far greater :) Reason: In the year 2014 there were hardly any DSA channels on youtube This very channel inspired the entire generation of Data-Structures TH-cam Channel.
@@kannanhassouna5706 Or the lecturers are too boring and don't make the lessons interesting, at the end of the day we are humans and operate on emotions
i do not think there exist any channel which is comparable to "my code school" , this guy explains the code in the most easy and logical way while others do spoon feeding .
I took the baby steps of programming (DSA) from this channel and after 7 years I am here again for my interview preparation. Only if the channel was continued we would have seen the golden content. But destiny had some other plans. :(
I cannot say enough how helpful these videos are. You are literally saving my grade, one video at a time. Thanks for being an amazing teacher, these videos are the BEST.
this method is so much better than the method suggested in my "introduction to algorithms" textbook. Much easier to understand, and the code is cleaner. Great job!
After looking through so many resources, I must say that your explanation is indeed the best one on this topic. Really easy to follow and understand. Thank you !
I had a hard time understanding the deletion process from BST, especially the third case, when a node we want to delete has both of its children. This video has made me understand, you explained very clearly, and I came to realize that the procedure is actually quite simple haha. Thank you very much! Your channel is my favorite when it comes to algorithm tutorials! Please keep posting more, I really enjoy them!
I have followed all your Data Structures videos, they are great! I love that you just dont explain the ADT but also show how to code it. That´s really helpful for somebody like me which still doesn't have lots of experience coding. Keep the good work! I'm waiting for your new videos to come out! =)
This is the simplest and best explanation for deletion of a node in BST. Take a bow from me. Thanks for making such a nice and useful video. I am grateful to you
best explanation on youtube in my opinion, this helped me when I took data structures and algorithms and it helped me again when I went to tutor it a year later. Well done and thank you.
Really True...After a long search found this Wonderfully Explained Video link for Data Structures and Algo..Specially for interview preparation so helpful.:):)
What a trick on case 3. Just wow, I was doing it the hard way. But you just made it soo simple, by continuing recursion and deleting the extra node with case 1. Mind-blowing 😄. Still Relevant even after 8 years
i rarely comment on your videos animesh sir but this was Truly Exceptional explanation, nobody explained it the way you did. This is why clean code and moreover the teacher matters so much. Again thank you so much for this contribution to the society . Love and Regards to you and Late Harsha Sir
Frankly speaking, after watching your videos, i have started feeling coding i.e. what actually go inside the computer when code runs. Well done bro!!👍👍🙏🙏
@@srishti1613 really sad to hear it. Sometimes life do not even give you opportunity to show gratitude for someone who has done someting good to you. Can you tell me how it happened? I mean, it was accidental or natural?
Good job ! clearly explained. There is just one remark about case 3 :In your example, you assume that the minimum Y is the right child of the deleted node Z, which is not always the exact : It could be somewhere else in Z's right subtree which have no left child (of course) but has a right subtree. In this case, if you just copy the node Y into node Z, and after that delete node Y : this won't work i think, because Y's right subtree will be lost.
I think you are right. When the node to be deleted finds the minimum in the right subtree, we need to verify if the parent of the right minimum is same as the node to be deleted. If yes, we do the same as what the instructor in this video said, otherwise we need to find the parent of the right minimum and set the left reference to NULL. I wrote this in Python like this (for the case with 2 children). I know I am answering 7 years later! 🙃 found = self.get_node(val) parent = self.get_node(val, True) right_minimum = BST(found.right).get_minimum() parent_right_minimum = self.get_node(right_minimum.val, need_parent=True) found.val = right_minimum.val if found is parent_right_minimum: parent_right_minimum.right = None else: parent_right_minimum.left = None In my case, I wrote a get_node function to find a node in the BST with the value needed. I also have an optional parameter in that method that gets me the parent of the node with the value I was looking for.
thank you so much, i've been struggling with understanding binary search trees so much, but your videos explain it so well! One video is worth 10 lessons at my uni lol.
Great explanation! Thank you. By the way, I'd like to point out that this deletion algorithm is not suitable for balanced trees since it will not preserve the balance. This algorithm is called Hibbard deletion, and one company was sued in the past for implementing this algorithm as the deletion method in a Red/Black tree implementation.
Great video! The if condition that checks for case 1 (leaf node) can be completely removed and it will still work. Case 2 will handle cases of leaf node too!
i had a lot of trouble understanding this! thank you so much! clear as hell explanation where all other lecturers failed. clear and simple and to the point! you are awesome my friend awesome!
Thanks for the video. Question on case 3, if there are two 17's on the right side, the tree would become invalid because you would have a value that is
4th video I am looking at, very good and clearly explained. Thank you for your effort! Had to recapitulate for an interview, ages since I learnt it in school and had to use it.
someone please continue this series , after the death of the owner no one is there to complete this series in the way he is continuing and i do not think any other can teach coding like this.
Boss....why struct node* temp = findMin(root->right); it should be int temp = findMin(root->right); root->data = temp; root->right = deleteData(root->right, temp); Many many thanks for your videos.....you are a greate teacher..:)
After deleting a node with two sub trees, we can connect parent of the deleted node with left sub tree of the deleted node . Also we need one more connection. We need to connect right most node of the left sub tree of the deleted node with the right sub tree of the deleted node . This approach would be way simpler than the approach mentioned in the video. BST property will always be conserved.
ankit mathur - We are also trying to figure out how to speed up. :P We focus on quality and its not so easy to speed up with quality. But we will try our best and publish videos more frequently. :)
@@adityaatri2053 he is not Harsha, the video maker is Aminesh he left making a video anymore since his partner died in accident and Animesh joined Google, therefore no time.
thank you so much....i think this was the best video of programming language i have ever seen....keep it up...and thanks....your quality of explaining the concept is really very good...
I felt returning and updating the root nodes after every deletion could be improved. So here is my code of using pointer to pointers. BTW this series is the best content out there. void Tree::deleteNode(Node** rootPtr, int elem) { Node*& root = *rootPtr; //root is an alias to what is pointed by rootPtr, now instead of using *rootPtr, can use root if (root==NULL) return; if (root->data > elem) deleteNode(&root->left, elem); else if (root->data < elem) deleteNode(&root->right, elem); else { if (root->right==NULL && root->left==NULL) { cout right; cout left; cout data = minNode->data; deleteNode(&root->right, minNode->data); } } } Node* Tree::findMin(Node *curRoot) { if (curRoot == NULL) { cout left != NULL) { curRoot = curRoot->left; } cout
Even in 2021 when there are so many videos/playlists available on TH-cam, it's hard to find this much easily understandable and quality content on DSA. 😍
i agere
100% agreed
2022
I completed the playlist
Can you please recommend resources for studying next concepts like graph algos, dp, etc?
@@CuriousAnonDev Unfortunately one of the two people who started this channel is no more.He died in an accident in US and the other person wasnt in right state of mind for few days.I hope they r both fine in their own worlds now ....lots of love to their work
The number of lives this channel has touched is far far greater :)
Reason: In the year 2014 there were hardly any DSA channels on youtube This very channel inspired the entire generation of Data-Structures TH-cam Channel.
amazing how my college professors don't take the time out to explain it in depth as much as you do, truly appreciate it.
because they themeselves don't understand it in depth. what a sorry state
i believe, in some case that we don't pay that attention in the lectures
@@kannanhassouna5706 Or the lecturers are too boring and don't make the lessons interesting, at the end of the day we are humans and operate on emotions
Who's watching in 2024? :D
It's me
Me 🙋
me
yes sir
i do not think there exist any channel which is comparable to "my code school" , this guy explains the code in the most easy and logical way while others do spoon feeding .
Out of all the search results TH-cam shows me when I search a specific topic
I always look for mycodeschool Videos.
Simply outstanding!
I have starting liking data structures after going through your videos.. Really appreciate !!!
I took the baby steps of programming (DSA) from this channel and after 7 years I am here again for my interview preparation. Only if the channel was continued we would have seen the golden content. But destiny had some other plans. :(
I cannot say enough how helpful these videos are. You are literally saving my grade, one video at a time. Thanks for being an amazing teacher, these videos are the BEST.
you could have said these videos are the BeST ;)
😂@@rayaankhan787
this method is so much better than the method suggested in my "introduction to algorithms" textbook. Much easier to understand, and the code is cleaner. Great job!
After looking through so many resources, I must say that your explanation is indeed the best one on this topic. Really easy to follow and understand.
Thank you !
not only is this video on the topic I need to learn for my data structures class, it also is in C++ which is what we are intended to use, amazing.
I had a hard time understanding the deletion process from BST, especially the third case, when a node we want to delete has both of its children. This video has made me understand, you explained very clearly, and I came to realize that the procedure is actually quite simple haha. Thank you very much! Your channel is my favorite when it comes to algorithm tutorials! Please keep posting more, I really enjoy them!
Same Here Right now for me.
I have followed all your Data Structures videos, they are great! I love that you just dont explain the ADT but also show how to code it. That´s really helpful for somebody like me which still doesn't have lots of experience coding. Keep the good work! I'm waiting for your new videos to come out! =)
This is the simplest and best explanation for deletion of a node in BST. Take a bow from me.
Thanks for making such a nice and useful video. I am grateful to you
best explanation on youtube in my opinion, this helped me when I took data structures and algorithms and it helped me again when I went to tutor it a year later. Well done and thank you.
Even in 2022 it is one of the most easily explained and intiuitive code for deletion of a node in a BST
I usually don't leave any comments, but this was very clear and helpful!! Thank you so much
I was obsessed with the tutorials of nptel.But now you guys are my brand new obsession after this video.
wow :)
Really True...After a long search found this Wonderfully Explained Video link for Data Structures and Algo..Specially for interview preparation so helpful.:):)
So much simpler than our data structures textbook! You are truely amazing!
What a trick on case 3. Just wow, I was doing it the hard way. But you just made it soo simple, by continuing recursion and deleting the extra node with case 1. Mind-blowing 😄. Still Relevant even after 8 years
A headache concept(for me), explained in the most simple way! Pure brilliance.
"Woohoo I found you, get ready to be deleted" 😂😂😂
Bazingaaaa
@@devprakash5320 huhh..Sheldon
😂😂😂😂😂
XD
the op is dead
i rarely comment on your videos animesh sir but this was Truly Exceptional explanation, nobody explained it the way you did. This is why clean code and moreover the teacher matters so much. Again thank you so much for this contribution to the society . Love and Regards to you and Late Harsha Sir
Frankly speaking, after watching your videos, i have started feeling coding i.e. what actually go inside the computer when code runs. Well done bro!!👍👍🙏🙏
He is no more!
@@srishti1613 really sad to hear it. Sometimes life do not even give you opportunity to show gratitude for someone who has done someting good to you.
Can you tell me how it happened? I mean, it was accidental or natural?
this channel will never get old, such gold!! Why did the channel owner stop posting?
Thank you I successfully implemented this in java code.
Recursion algorithms need more time to be understood but thanks to you it took only 18:26 !!
Really a good explanation of BST.Worth watching to this tutorial.Neatly explained.Thank you so much.
Good job ! clearly explained. There is just one remark about case 3 :In your example, you assume that the minimum Y is the right child of the deleted node Z, which is not always the exact : It could be somewhere else in Z's right subtree which have no left child (of course) but has a right subtree. In this case, if you just copy the node Y into node Z, and after that delete node Y : this won't work i think, because Y's right subtree will be lost.
I think you are right. When the node to be deleted finds the minimum in the right subtree, we need to verify if the parent of the right minimum is same as the node to be deleted. If yes, we do the same as what the instructor in this video said, otherwise we need to find the parent of the right minimum and set the left reference to NULL. I wrote this in Python like this (for the case with 2 children). I know I am answering 7 years later! 🙃
found = self.get_node(val)
parent = self.get_node(val, True)
right_minimum = BST(found.right).get_minimum()
parent_right_minimum = self.get_node(right_minimum.val, need_parent=True)
found.val = right_minimum.val
if found is parent_right_minimum:
parent_right_minimum.right = None
else:
parent_right_minimum.left = None
In my case, I wrote a get_node function to find a node in the BST with the value needed. I also have an optional parameter in that method that gets me the parent of the node with the value I was looking for.
excellent explanation of deleting element from BST.
Thanks.
This series is beautifully crafted. completely flawless . i would even pay to watch your videos.
Unfortunately he is dead 😔
@@sharmanihal99 you're kidding right?
Even in 2022 this content is gold in youtube
thank you so much, i've been struggling with understanding binary search trees so much, but your videos explain it so well!
One video is worth 10 lessons at my uni lol.
Really sorry to know that co founder harsha is no more. Really appreciate whatever you guys have done for us
Great explanation! Thank you.
By the way, I'd like to point out that this deletion algorithm is not suitable for balanced trees since it will not preserve the balance. This algorithm is called Hibbard deletion, and one company was sued in the past for implementing this algorithm as the deletion method in a Red/Black tree implementation.
This is only for binary search tree .. it won't work for AVL trees and Red Black trees
Thank you so much for making the most informational and understandable videos on BSTs. Saved my grade in data structures!
//Function to find minimum in a tree.
Node* FindMin(Node* root)
{
while(root->left != NULL) root = root->left;
return root;
}
correct
but we are interested in finding maximum in left subtree or minimum in right subtree..and you are showing the overall minimum for an entire tree...
@@NEERAJKUMAR-db9se Every subtree is also a binary search tree
@@NEERAJKUMAR-db9se for function FindMin() Node* root is variable. We can use it for the right subtree as well.
return root->data
Great video! The if condition that checks for case 1 (leaf node) can be completely removed and it will still work. Case 2 will handle cases of leaf node too!
i had a lot of trouble understanding this! thank you so much! clear as hell explanation where all other lecturers failed. clear and simple and to the point! you are awesome my friend awesome!
please upload the video of hashing,avl trees ,graphs.i have been watcing your series and it helps me alot in clearing the most difficulty parts.
Your lectures are awesome,easy to understand and practise. Thanks for your effort.
Deletion in BST part is always tricky and hard. You explained well. Thank you
this is the best content you can find to exist
for (i=0 ; i < inf ; i++){
System.out.println(" Thank you ");
}
This will not compile...Rather it will give an error...
class name not declared..
no main function..
data type of "i" unknown..
"inf" is unknown..
I just can not switch from this page without thanking You! For having learnt from your videos. Thank You very much.
Woah. That's the best explanation of the delete operation I've ever read/watched.
Thank you very much.
Best TH-cam channel on dsa
I directly started trees ds,and i really loveing it because of you buddy
I watched almost 5 videos of binary tree deletion but still I only like your video ❤❤❤❤❤
Thanks for the video. Question on case 3, if there are two 17's on the right side, the tree would become invalid because you would have a value that is
Thank you. Literally helped comfirmed my idea of finding the max on the left side. I'll do just that now.
Your videos are probably the best explanations i have ever got! Thank you so much!
Man of magic. 10yrs old. Still we re watching
Super clear explanation on BST node deletion. Thank you.
great video, your English is very clear.
Thanks! Your explanation was easy to follow
You are a God. You are the first channel i enabled notifications.
Thank you so much
4th video I am looking at, very good and clearly explained. Thank you for your effort! Had to recapitulate for an interview, ages since I learnt it in school and had to use it.
Best video on BST deletion.
what a nice explanation sir
best explaination I've found for this.
someone please continue this series , after the death of the owner no one is there to complete this series in the way he is continuing and i do not think any other can teach coding like this.
Boss....why
struct node* temp = findMin(root->right);
it should be
int temp = findMin(root->right);
root->data = temp;
root->right = deleteData(root->right, temp);
Many many thanks for your videos.....you are a greate teacher..:)
because that function will return the NODE with minimum value(i.e., it'll have data, left and right).
Thanks for the videos, would have been good if I discovered this videos at the beginning of my education
after 10 years thank you sssssssooooooooo much
After deleting a node with two sub trees, we can connect parent of the deleted node with left sub tree of the deleted node . Also we need one more connection. We need to connect right most node of the left sub tree of the deleted node with the right sub tree of the deleted node . This approach would be way simpler than the approach mentioned in the video. BST property will always be conserved.
It seems that u have great understanding of concepts and nice way of explaining too.Hoping to post many more concepts.
you are great! I am watching your video from school 42! Thank you.
Your lectures r awsm..bt plz increase ur speed of uploading new videos....we r eagerly waiting for more lectures in this series...plz be fast
ankit mathur - We are also trying to figure out how to speed up. :P We focus on quality and its not so easy to speed up with quality. But we will try our best and publish videos more frequently. :)
people are hungry for knowledge :p
ankit mathur I hope he will upload a spelling video too.
Very well explained sir,i wish you luck in your life
This is amazing. Do tutorials on AVL trees, B Tress and hash tables. Please, pretty please?
@@amitdutta5610 Harsha SuryaNarayana , one of the best coder that India has ever produced.
@@adityaatri2053 the humblefool
He is not alive .
@@adityaatri2053 he is not Harsha, the video maker is Aminesh he left making a video anymore since his partner died in accident and Animesh joined Google, therefore no time.
Brother unfortunately he is no more..!!
Fantastic video. Your description helped me to understand tree deletion. Thanks.
thank you so much....i think this was the best video of programming language i have ever seen....keep it up...and thanks....your quality of explaining the concept is really very good...
This dude is a born legend.
This dude is no more😭.
God took him to teach binary tree.
dude Ur best..compared all other tutorials..tnks for helping
I don't know why the font is comic sans but I appreciate the good content
You are the best. Just Best. You made it so easy. Salute you.
You are the Best Teacher
Thank you very much for your clear and concise videos on data structures!
You r the best.. The best explanation I could ever get..
I felt returning and updating the root nodes after every deletion could be improved. So here is my code of using pointer to pointers. BTW this series is the best content out there.
void Tree::deleteNode(Node** rootPtr, int elem)
{
Node*& root = *rootPtr; //root is an alias to what is pointed by rootPtr, now instead of using *rootPtr, can use root
if (root==NULL) return;
if (root->data > elem) deleteNode(&root->left, elem);
else if (root->data < elem) deleteNode(&root->right, elem);
else
{
if (root->right==NULL && root->left==NULL)
{
cout right;
cout left;
cout data = minNode->data;
deleteNode(&root->right, minNode->data);
}
}
}
Node* Tree::findMin(Node *curRoot)
{
if (curRoot == NULL)
{
cout left != NULL)
{
curRoot = curRoot->left;
}
cout
Wow it's amazing tutorial and good channel. For many problems related to coding and dry run I get solution from here.keep it going 👌
Very nice explanation and solution for deletion
all your concept explanation is awesome sir
Nice collection of data
if you want to update then root->right=function() or else just function(). Here you need to update each and every process. And get the upmost root.
This man is my savior
You have a very good way of explaining stuff in your videos! Great job!
The best explenation on TH-cam!!
Great Sir. Very lucid explanation.
Pretty good explaination!
thank you so much for such a clear tutorial and thorough explanation!
man you saved my semester
it's more than 5 years now,
you're in a job now ??
ur tutorials are worth of watching...can u explain all these stuffs in tree using loops also ??
But recursion makes it elegant
love your videos! I watch them every day!
best explanation of delete node
The best course ever thaaaaank youuuuuu so much 🙏🙏🙏🙏
Really good and easy to understand explanation of delete operation. Thank you!
Beautiful application of recursion.
You should have mention inorder successor. It would probably made more sense. Good video.
and there goes one more excellent video..