case 3 is not correct, if 6 has 2 child (left, right), for example, 5.9 and 6.1. the right way is to find min value of right tree (5.9), replace it with deleted node (replace 5 with 5.9), then call recursive to delete min value (5.9) on right tree (which is back to case 2)
Nice explanation! Before watching, I was always unsure, rather it is necessary to delete the data inside the node, which we want to delete... But as it seems it is enough, when we just remove the pointer/reference to the node, which we want to delete.(For example in case 1) As the garbage collector will do the rest.
In case you meant the last tree drawn, you get 3's successor, which is 4. We know that 4 has no left child (otherwise, 4 wouldn't be the successor, which is a contradiction). Replace 3 with 4, and the right child of 3 will be the right child of 4. The left child of 3 will also be the left child of 4. Thus, we maintained the binary search tree property.
If 6 has a left child then that child would be the inorder succesor, not 6.The inorder succesor of a node has no left child but it can have a right child
case 3 is not correct, if 6 has 2 child (left, right), for example, 5.9 and 6.1. the right way is to find min value of right tree (5.9), replace it with deleted node (replace 5 with 5.9), then call recursive to delete min value (5.9) on right tree (which is back to case 2)
That was my understanding too. Replace the node with its in-order successor (the minimum value node in its right subtree)
Your videos are really easy to understand. Hats off. I build of Binary tree and implemented all operations on my own. Thanks
What if, when deleting 5 and replacing it with 6, if the node 6 also had children, what do we do?
We are replacing with the inorder successor. Inorder successor usually is a leaf node when it comes to deletion
Hello Lalitha, I loved your explanation about deletion, for sure was the best video for me to understand that. Thank you for posting that :)
Nice explanation!
Before watching, I was always unsure, rather it is necessary to delete the data inside the node, which we want to delete... But as it seems it is enough, when we just remove the pointer/reference to the node, which we want to delete.(For example in case 1)
As the garbage collector will do the rest.
What if you are using c/c++ or performance is crucial?
@@georgiilkov9915 THEN YOU CRY
@@MrNukenin16 or learn memory management
Thank you for the clear, and simple explanation! Seems like most tutorials cannot explain it this easily.
Thank you very much madam. It is very good to explain your lesson & I like your explanation ❤️
thank you so much for your amazing helpful simple easy explanation, please keem. making these videos ❤️
omg thank you sooooooooooooooooooo much you're a life savour
What about duplicates ?
Thanks for the video! I screenshotted this!
Thanks for your knowledge based class mam
what is an inorder traversal?
very concise and clear, thank you
Mam case 3 is not right LEFT MOST ELEMENT IN RIGHT SUBTREE REVIEW IT PLZ
Thank you very much, I like your explanation
Every things are so good... Thanxx
Good explanation...
What if the 6 in case 3 already has 2 children?
I wondered the same thing.
inorder successor will become the right child of 6 and replace it with 5
Mam why you replace 6
You makes everything easy thank you so much ma'am
grate video :D
Becouse in binary search tree right side last node is greater than
THANK YOU!! my textbook makes it sound so confusing
Very clear thank u so much
what if you remove 3?
In case you meant the last tree drawn, you get 3's successor, which is 4. We know that 4 has no left child (otherwise, 4 wouldn't be the successor, which is a contradiction). Replace 3 with 4, and the right child of 3 will be the right child of 4. The left child of 3 will also be the left child of 4. Thus, we maintained the binary search tree property.
Thank you ❤️
Please make a video in linked list insertion deletion
What if 6 has its two children. Then where the left child of 6 goes after performing deletion .
If 6 has a left child then that child would be the inorder succesor, not 6.The inorder succesor of a node has no left child but it can have a right child
inorder successor of 5 is 4 not 6!
the inorder successor element of its right subtree!
1000 thanks
U r voice awesome maam....💞 and great explanation.......
Assho*#
@@travislarrat3439 why xD
good
You replace 4
Thank you so much!!
Superb
Hindi explanation of same problem - ruclips.net/video/XPGU8oFpJVA/видео.html
super mam.
This wrong answer
what if 6 has children nodes?
The left child of 6 will become the right child of the left child of 6 and the right child of 6 will remain same.
@@beastbeautybiker6656 What is the algorithm for that case
please help im under the water
Thank you so much!!!