Delete a node from Binary Search Tree

See complete series on data structures here:
• Data structures
In this lesson, we have discussed deletion of a node from binary search tree data structure. We have discussed the core logic and written implementation of it in C++.
See source code here:
gist.github.com/mycodeschool/...
For practice problems and more, visit: www.mycodeschool.com
Like us on Facebook: / mycodeschool
Follow us on twitter: / mycodeschool

Пікірлер: 668

  • @phew...6097
    @phew...60974 ай бұрын

    Who's watching in 2024? :D

  • @muralikrishna.ruttala5546

    @muralikrishna.ruttala5546

    2 ай бұрын

    It's me

  • @Mr.Aziz.753

    @Mr.Aziz.753

    29 күн бұрын

    Me 🙋

  • @lv3234

    @lv3234

    28 күн бұрын

    me

  • @RandomSerialKiller
    @RandomSerialKiller3 жыл бұрын

    Even in 2021 when there are so many videos/playlists available on KZread, it's hard to find this much easily understandable and quality content on DSA. 😍

  • @yashpatidar.8506

    @yashpatidar.8506

    3 жыл бұрын

    i agere

  • @Shourya_performs

    @Shourya_performs

    2 жыл бұрын

    100% agreed

  • @vengalrao5772

    @vengalrao5772

    2 жыл бұрын

    2022

  • @CuriousAnonDev

    @CuriousAnonDev

    2 жыл бұрын

    I completed the playlist Can you please recommend resources for studying next concepts like graph algos, dp, etc?

  • @julurisaiteja8853

    @julurisaiteja8853

    Жыл бұрын

    @@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

  • @iamparitosh
    @iamparitosh3 жыл бұрын

    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 KZread Channel.

  • @pfever
    @pfever10 жыл бұрын

    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! =)

  • @waiuphigh
    @waiuphigh9 жыл бұрын

    amazing how my college professors don't take the time out to explain it in depth as much as you do, truly appreciate it.

  • @vikranttyagiRN

    @vikranttyagiRN

    4 жыл бұрын

    because they themeselves don't understand it in depth. what a sorry state

  • @kannanhassouna5706

    @kannanhassouna5706

    2 жыл бұрын

    i believe, in some case that we don't pay that attention in the lectures

  • @conradmbugua9098

    @conradmbugua9098

    Жыл бұрын

    @@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

  • @lindawisebear
    @lindawisebear5 жыл бұрын

    "Woohoo I found you, get ready to be deleted" 😂😂😂

  • @devprakash5320

    @devprakash5320

    4 жыл бұрын

    Bazingaaaa

  • @aakashyadav6228

    @aakashyadav6228

    4 жыл бұрын

    @@devprakash5320 huhh..Sheldon

  • @kunalsoni7681

    @kunalsoni7681

    4 жыл бұрын

    😂😂😂😂😂

  • @iamparitosh

    @iamparitosh

    3 жыл бұрын

    XD

  • @hacksbsb

    @hacksbsb

    3 жыл бұрын

    the op is dead

  • @pranatinayak1463
    @pranatinayak14638 жыл бұрын

    I have starting liking data structures after going through your videos.. Really appreciate !!!

  • @BhagatBikash
    @BhagatBikash4 жыл бұрын

    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 !

  • @anuragphadnis7806
    @anuragphadnis7806 Жыл бұрын

    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. :(

  • @afrozanjum5086
    @afrozanjum50862 жыл бұрын

    Out of all the search results KZread shows me when I search a specific topic I always look for mycodeschool Videos. Simply outstanding!

  • @sagarikakadambi3720
    @sagarikakadambi37209 жыл бұрын

    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.

  • @rayaankhan787

    @rayaankhan787

    2 жыл бұрын

    you could have said these videos are the BeST ;)

  • @dhakad22klx

    @dhakad22klx

    11 ай бұрын

    😂@@rayaankhan787

  • @ramyaradhakrishnan7881
    @ramyaradhakrishnan78819 жыл бұрын

    Really a good explanation of BST.Worth watching to this tutorial.Neatly explained.Thank you so much.

  • @TehFingergunz
    @TehFingergunz7 жыл бұрын

    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.

  • @thecuriousone12
    @thecuriousone1210 жыл бұрын

    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!

  • @molyoxide8358

    @molyoxide8358

    2 жыл бұрын

    Same Here Right now for me.

  • @LDARSHAN1991
    @LDARSHAN19916 жыл бұрын

    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

  • @TheANTIdos
    @TheANTIdos7 жыл бұрын

    Woah. That's the best explanation of the delete operation I've ever read/watched. Thank you very much.

  • @richardqian7232
    @richardqian72322 жыл бұрын

    Thank you so much for making the most informational and understandable videos on BSTs. Saved my grade in data structures!

  • @t5a55i
    @t5a55i8 жыл бұрын

    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.

  • @loopzz5526
    @loopzz55262 жыл бұрын

    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

  • @happinin
    @happinin9 жыл бұрын

    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!

  • @alexrider1105
    @alexrider11053 ай бұрын

    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!

  • @jamescheng6922
    @jamescheng69227 жыл бұрын

    I usually don't leave any comments, but this was very clear and helpful!! Thank you so much

  • @akhilrajnambiar2080
    @akhilrajnambiar20803 жыл бұрын

    A headache concept(for me), explained in the most simple way! Pure brilliance.

  • @nikkygeorgephilip5242
    @nikkygeorgephilip52425 жыл бұрын

    Your lectures are awesome,easy to understand and practise. Thanks for your effort.

  • @milaismyname
    @milaismyname6 жыл бұрын

    Your videos are probably the best explanations i have ever got! Thank you so much!

  • @supriyas7742
    @supriyas77429 жыл бұрын

    I just can not switch from this page without thanking You! For having learnt from your videos. Thank You very much.

  • @nicholaspalceski1235
    @nicholaspalceski12354 ай бұрын

    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.

  • @butlikereally
    @butlikereally6 жыл бұрын

    this was the best explanation i could find on the internet. THANK YOU

  • @TheNPoet
    @TheNPoet6 жыл бұрын

    You have a very good way of explaining stuff in your videos! Great job!

  • @kostasnikoloutsos5172
    @kostasnikoloutsos51725 жыл бұрын

    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 !!

  • @mzubair21
    @mzubair212 жыл бұрын

    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

  • @swatiagrawal5385
    @swatiagrawal53858 жыл бұрын

    excellent explanation of deleting element from BST. Thanks.

  • @musyllabus8401
    @musyllabus84018 жыл бұрын

    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...

  • @itzcs1861
    @itzcs18615 жыл бұрын

    This series is beautifully crafted. completely flawless . i would even pay to watch your videos.

  • @sharmanihal99

    @sharmanihal99

    4 жыл бұрын

    Unfortunately he is dead 😔

  • @ash11music

    @ash11music

    4 жыл бұрын

    @@sharmanihal99 you're kidding right?

  • @subashreddy4993
    @subashreddy49937 жыл бұрын

    It seems that u have great understanding of concepts and nice way of explaining too.Hoping to post many more concepts.

  • @amellperalta
    @amellperalta7 жыл бұрын

    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.

  • @stormshadow76

    @stormshadow76

    Жыл бұрын

    This is only for binary search tree .. it won't work for AVL trees and Red Black trees

  • @NiteshKumar-xm3nq
    @NiteshKumar-xm3nq6 ай бұрын

    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 .

  • @PeVoNZ
    @PeVoNZ8 жыл бұрын

    Thank you very much for your clear and concise videos on data structures!

  • @pomegranate3601
    @pomegranate360111 ай бұрын

    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.

  • @newoap
    @newoap10 жыл бұрын

    Fantastic video. Your description helped me to understand tree deletion. Thanks.

  • @soniachawla2554
    @soniachawla25548 жыл бұрын

    I was obsessed with the tutorials of nptel.But now you guys are my brand new obsession after this video.

  • @priyanshugupta7904

    @priyanshugupta7904

    3 жыл бұрын

    wow :)

  • @rishikeshkumar490

    @rishikeshkumar490

    3 жыл бұрын

    Really True...After a long search found this Wonderfully Explained Video link for Data Structures and Algo..Specially for interview preparation so helpful.:):)

  • @bas56
    @bas564 ай бұрын

    So much simpler than our data structures textbook! You are truely amazing!

  • @kevingarner7231
    @kevingarner72318 жыл бұрын

    This video was immensely helpful. Thank you!

  • @1gouravgg
    @1gouravgg10 жыл бұрын

    and there goes one more excellent video..

  • @clintonahong
    @clintonahong10 жыл бұрын

    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.

  • @vladn.2332
    @vladn.23326 жыл бұрын

    Really good and easy to understand explanation of delete operation. Thank you!

  • @senpaitriton
    @senpaitriton7 жыл бұрын

    The best explenation on KZread!!

  • @haigangzhang8039
    @haigangzhang80393 жыл бұрын

    love your videos! I watch them every day!

  • @sergiojimenez3445
    @sergiojimenez34457 жыл бұрын

    Thanks for the videos, would have been good if I discovered this videos at the beginning of my education

  • @dipeshbudhiraja8557
    @dipeshbudhiraja85577 жыл бұрын

    //Function to find minimum in a tree. Node* FindMin(Node* root) { while(root->left != NULL) root = root->left; return root; }

  • @kartikxramesh

    @kartikxramesh

    5 жыл бұрын

    correct

  • @NEERAJKUMAR-db9se

    @NEERAJKUMAR-db9se

    4 жыл бұрын

    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...

  • @nikolastevic2278

    @nikolastevic2278

    4 жыл бұрын

    @@NEERAJKUMAR-db9se Every subtree is also a binary search tree

  • @sudeshchaudhary4558

    @sudeshchaudhary4558

    4 жыл бұрын

    @@NEERAJKUMAR-db9se for function FindMin() Node* root is variable. We can use it for the right subtree as well.

  • @alterguy4327

    @alterguy4327

    4 жыл бұрын

    return root->data

  • @jeffisded1222
    @jeffisded12222 ай бұрын

    Thanks! Your explanation was easy to follow

  • @mums2109
    @mums21092 жыл бұрын

    You are such a great teacher! Thank you!

  • @nirmalaarunkumar
    @nirmalaarunkumar2 жыл бұрын

    Simple and straightforward .Thank you!!

  • @debaratighatak2211
    @debaratighatak22113 жыл бұрын

    Thank you so much for explaining the recursion part so well :D!

  • @BlazedOutTurtle
    @BlazedOutTurtle8 жыл бұрын

    Thank you for such a clear explanation !

  • @palakjain2505
    @palakjain25052 жыл бұрын

    this channel will never get old, such gold!! Why did the channel owner stop posting?

  • @Avighna
    @Avighna7 ай бұрын

    You are amazing at explaining this, keep it up!

  • @Inefprag
    @Inefprag8 жыл бұрын

    Thank you for making this tutorial! It's very helpful. :)

  • @emiliobascary4793
    @emiliobascary47938 жыл бұрын

    excelent explanation! like all your videos, please keep doing this lessons

  • @krishnakrmahto97
    @krishnakrmahto975 жыл бұрын

    the playlist is really helpful!

  • @nlilley9741
    @nlilley97413 жыл бұрын

    Super clear explanation on BST node deletion. Thank you.

  • @gauravbharti5390
    @gauravbharti53904 жыл бұрын

    Really nice ! Its clearing my concepts !! Its simple and to the point.

  • @RawanLaz
    @RawanLaz9 жыл бұрын

    amazing as usual ... you are simply AMAZING instructor thank you so much

  • @MaheshDhoni
    @MaheshDhoni9 жыл бұрын

    Thank you. Excellent video .

  • @nr.bln.
    @nr.bln.3 жыл бұрын

    best explaination I've found for this.

  • @tangudusaikiran5893
    @tangudusaikiran58933 жыл бұрын

    I directly started trees ds,and i really loveing it because of you buddy

  • @monumurari2876
    @monumurari28767 жыл бұрын

    all your concept explanation is awesome sir

  • @innoirvinge8431
    @innoirvinge84318 жыл бұрын

    Wow, this video is awesome! I was stuck with the delete function and couldnt figure out how to link the current ptr with its parent node :o, I did see a lot of sample codes and didnt understand how the recursion unfolds and sure enough I was missing that return statement :( I initially had my delete function to be void, now I understand what the return is for. Thank you so much, will definitely be watching more of your videos

  • @MoguMogu818
    @MoguMogu8189 ай бұрын

    Thank you. Literally helped comfirmed my idea of finding the max on the left side. I'll do just that now.

  • @Joymyhome
    @Joymyhome6 жыл бұрын

    Very well explained! Thank you! I have a question. So since deleting max from right subtree and min from left subtree both make deletion work(for the case when a node with 2 children), which subtree do we choose?

  • @jakeharding8528
    @jakeharding85286 жыл бұрын

    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

  • @nagaraju5433
    @nagaraju54338 жыл бұрын

    Deletion in BST part is always tricky and hard. You explained well. Thank you

  • @mersihaceranic6762
    @mersihaceranic67626 жыл бұрын

    Thank you so much. The best one so far!

  • @Iamhere-em2us
    @Iamhere-em2usАй бұрын

    Man of magic. 10yrs old. Still we re watching

  • @bama2619
    @bama26192 жыл бұрын

    you are great! I am watching your video from school 42! Thank you.

  • @pavittarkumarazad3259
    @pavittarkumarazad32594 жыл бұрын

    Never stop making videos! You are awesome :)

  • @AfhamAdian
    @AfhamAdian Жыл бұрын

    this is the best content you can find to exist

  • @asmitanand7951
    @asmitanand79517 жыл бұрын

    Thank you so much for awesome tutorials.

  • @joshuadgoldberg1176
    @joshuadgoldberg11765 жыл бұрын

    great video, your English is very clear.

  • @a3f35522
    @a3f355229 жыл бұрын

    Thank you, This was very useful for me!

  • @hdaouihakim
    @hdaouihakim7 жыл бұрын

    Simply perfectly explained.

  • @CodeMalek
    @CodeMalek4 жыл бұрын

    14:22 "i hope this is making sense" my brain : farting

  • @kaus05

    @kaus05

    2 жыл бұрын

    Glad i am not the only one lmao

  • @burabazt1307

    @burabazt1307

    6 ай бұрын

    @@kaus05 bro this shit just making my head like its gonna explosive

  • @vasilisdamianopoulos4540
    @vasilisdamianopoulos45402 жыл бұрын

    You are a God. You are the first channel i enabled notifications. Thank you so much

  • @richardjean-baptiste5170
    @richardjean-baptiste51709 жыл бұрын

    Thank you for your video, it helped me so much!

  • @iamrajagrawal
    @iamrajagrawal6 жыл бұрын

    Your explanation it too good. Thanks buddy!

  • @AzureSupremuZ
    @AzureSupremuZ3 жыл бұрын

    Great tutorial. Makes so much sense now.

  • @flicksonj
    @flicksonj Жыл бұрын

    Wow, very nice explanation!!

  • @RajSehmi5293
    @RajSehmi52935 жыл бұрын

    You are the best. Just Best. You made it so easy. Salute you. You are the Best Teacher

  • @kapilchoudhary2922
    @kapilchoudhary2922 Жыл бұрын

    Phenomenal explanation. Thanks!

  • @waleedosama1630
    @waleedosama16307 жыл бұрын

    massive like ... i hope you keep on explainig everything in computer engineering :)

  • @sumeetkamat
    @sumeetkamat8 жыл бұрын

    Excellent explanation!

  • @devjeff3192
    @devjeff31922 ай бұрын

    Pretty good explaination!

  • @DhruvilPatel
    @DhruvilPatel3 жыл бұрын

    Simple and clear, thanks!

  • @vishalreddy3531
    @vishalreddy35317 жыл бұрын

    dude Ur best..compared all other tutorials..tnks for helping

  • @kidsstation10
    @kidsstation106 жыл бұрын

    very informative and simple explanation, thank you very much sir

  • @hruturajkedar2736
    @hruturajkedar27365 жыл бұрын

    Best KZread channel on dsa

  • @soumitadalal6130
    @soumitadalal61304 жыл бұрын

    You r the best.. The best explanation I could ever get..

  • @AnkitKumar-yr1md
    @AnkitKumar-yr1md3 жыл бұрын

    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

    @srishti1613

    3 жыл бұрын

    He is no more!

  • @AnkitKumar-yr1md

    @AnkitKumar-yr1md

    3 жыл бұрын

    @@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?

  • @afsarabc
    @afsarabc8 жыл бұрын

    Awesome explanation! Thanks

  • @cdential3561
    @cdential35614 жыл бұрын

    Explained very well! Thank you