Delete a node from Binary Search Tree

Поделиться
HTML-код
  • Опубликовано: 3 янв 2025

Комментарии • 676

  • @SomeoneScary
    @SomeoneScary 3 года назад +321

    Even in 2021 when there are so many videos/playlists available on RUclips, 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 3 года назад +2

      100% agreed

    • @vengalrao5772
      @vengalrao5772 2 года назад +4

      2022

    • @CuriousAnonDev
      @CuriousAnonDev 2 года назад +2

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

    • @julurisaiteja8853
      @julurisaiteja8853 2 года назад +2

      @@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
    @iamparitosh 3 года назад +87

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

  • @waiuphigh
    @waiuphigh 9 лет назад +64

    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 5 лет назад +24

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

    • @kannanhassouna5706
      @kannanhassouna5706 3 года назад +4

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

    • @conradmbugua9098
      @conradmbugua9098 2 года назад +4

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

  • @afrozanjum5086
    @afrozanjum5086 2 года назад +1

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

  • @pranatinayak1463
    @pranatinayak1463 9 лет назад +62

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

  • @NiteshKumar-xm3nq
    @NiteshKumar-xm3nq 11 месяцев назад +1

    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 .

  • @sagarikakadambi3720
    @sagarikakadambi3720 9 лет назад +43

    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 года назад +11

      you could have said these videos are the BeST ;)

    • @dhakad22klx
      @dhakad22klx Год назад

      😂@@rayaankhan787

  • @phew...6097
    @phew...6097 9 месяцев назад +171

    Who's watching in 2024? :D

  • @alexrider1105
    @alexrider1105 8 месяцев назад +1

    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!

  • @anuragphadnis7806
    @anuragphadnis7806 Год назад +2

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

  • @TehFingergunz
    @TehFingergunz 7 лет назад +4

    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
    @thecuriousone12 10 лет назад +9

    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!

  • @BhagatBikash
    @BhagatBikash 4 года назад +4

    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 !

  • @pfever
    @pfever 10 лет назад +30

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

  • @EbyRocks22
    @EbyRocks22 Месяц назад +1

    Thank you so much for this. I watched the explanation and felt for the first time that I was understanding it. I will soon try writing it myself and see how it goes!

  • @nicholaspalceski1235
    @nicholaspalceski1235 9 месяцев назад

    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.

  • @jamescheng6922
    @jamescheng6922 7 лет назад +4

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

  • @bas56
    @bas56 9 месяцев назад

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

  • @soniachawla2554
    @soniachawla2554 8 лет назад +2

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

    • @priyanshugupta7904
      @priyanshugupta7904 4 года назад

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

  • @LDARSHAN1991
    @LDARSHAN1991 7 лет назад

    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

  • @akhilrajnambiar2080
    @akhilrajnambiar2080 3 года назад +3

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

  • @itzcs1861
    @itzcs1861 5 лет назад +2

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

    • @sharmanihal99
      @sharmanihal99 5 лет назад

      Unfortunately he is dead 😔

    • @ash11music
      @ash11music 5 лет назад

      @@sharmanihal99 you're kidding right?

  • @lindawisebear
    @lindawisebear 5 лет назад +417

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

  • @pomegranate3601
    @pomegranate3601 Год назад

    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.

  • @kostasnikoloutsos5172
    @kostasnikoloutsos5172 6 лет назад +1

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

  • @TheANTIdos
    @TheANTIdos 8 лет назад +1

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

  • @okaybossiamonyoutubeakkskd
    @okaybossiamonyoutubeakkskd 2 года назад +1

    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

  • @ramyaradhakrishnan7881
    @ramyaradhakrishnan7881 10 лет назад +23

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

  • @richardqian7232
    @richardqian7232 2 года назад +1

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

  • @swatiagrawal5385
    @swatiagrawal5385 8 лет назад +51

    excellent explanation of deleting element from BST.
    Thanks.

  • @AfhamAdian
    @AfhamAdian Год назад

    this is the best content you can find to exist

  • @mzubair21
    @mzubair21 2 года назад

    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

  • @AnkitKumar-yr1md
    @AnkitKumar-yr1md 4 года назад +1

    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 4 года назад +1

      He is no more!

    • @AnkitKumar-yr1md
      @AnkitKumar-yr1md 4 года назад

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

  • @happinin
    @happinin 10 лет назад +13

    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!

  • @supriyas7742
    @supriyas7742 9 лет назад

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

  • @niteshkushwaha9493
    @niteshkushwaha9493 2 года назад

    Even in 2022 it is one of the most easily explained and intiuitive code for deletion of a node in a BST

  • @milaismyname
    @milaismyname 7 лет назад +1

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

  • @hruturajkedar2736
    @hruturajkedar2736 6 лет назад +1

    Best RUclips channel on dsa

  • @vasilisdamianopoulos4540
    @vasilisdamianopoulos4540 2 года назад

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

  • @t5a55i
    @t5a55i 9 лет назад +1

    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.

  • @tangudusaikiran5893
    @tangudusaikiran5893 3 года назад

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

  • @palakjain2505
    @palakjain2505 2 года назад

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

  • @nr.bln.
    @nr.bln. 3 года назад +1

    best explaination I've found for this.

  • @nikkygeorgephilip5242
    @nikkygeorgephilip5242 6 лет назад +2

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

  • @aditya4707
    @aditya4707 3 года назад +1

    Even in 2022 this content is gold in youtube

  • @joshuadgoldberg1176
    @joshuadgoldberg1176 6 лет назад +1

    great video, your English is very clear.

  • @bama2619
    @bama2619 2 года назад

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

  • @CodeMalek
    @CodeMalek 4 года назад +22

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

    • @kaus05
      @kaus05 3 года назад +1

      Glad i am not the only one lmao

    • @burabazt1307
      @burabazt1307 11 месяцев назад +1

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

  • @nlilley9741
    @nlilley9741 3 года назад

    Super clear explanation on BST node deletion. Thank you.

  • @dipeshbudhiraja8557
    @dipeshbudhiraja8557 7 лет назад +105

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

    • @kartikxramesh
      @kartikxramesh 5 лет назад +2

      correct

    • @NEERAJKUMAR-db9se
      @NEERAJKUMAR-db9se 5 лет назад +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 5 лет назад +4

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

    • @sudeshchaudhary4558
      @sudeshchaudhary4558 5 лет назад +3

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

    • @alterguy4327
      @alterguy4327 5 лет назад +1

      return root->data

  • @newoap
    @newoap 10 лет назад

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

  • @Tt88688
    @Tt88688 4 дня назад +1

    Cleverly designed and explained

  • @amellperalta
    @amellperalta 8 лет назад +8

    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 2 года назад +1

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

  • @MoguMogu818
    @MoguMogu818 Год назад

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

  • @butlikereally
    @butlikereally 6 лет назад

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

  • @MinecraftLetstime
    @MinecraftLetstime 6 лет назад +2

    This dude is a born legend.

    • @SumitKumar-ww7he
      @SumitKumar-ww7he 4 года назад

      This dude is no more😭.
      God took him to teach binary tree.

  • @TheRohit901
    @TheRohit901 4 года назад +1

    Really sorry to know that co founder harsha is no more. Really appreciate whatever you guys have done for us

  • @vitaminato
    @vitaminato 10 лет назад +2

    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.

    • @s98ks22
      @s98ks22 2 года назад +1

      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.

  • @Chaimaa.allali.03
    @Chaimaa.allali.03 7 месяцев назад +1

    after 10 years thank you sssssssooooooooo much

  • @jeffisded1222
    @jeffisded1222 7 месяцев назад +1

    Thanks! Your explanation was easy to follow

  • @senpaitriton
    @senpaitriton 7 лет назад

    The best explenation on RUclips!!

  • @musyllabus8401
    @musyllabus8401 9 лет назад

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

  • @Abhaysharma89-p3p
    @Abhaysharma89-p3p Год назад

    I watched almost 5 videos of binary tree deletion but still I only like your video ❤❤❤❤❤

  • @sergiojimenez3445
    @sergiojimenez3445 8 лет назад +2

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

  • @AmodShindeDev
    @AmodShindeDev 9 лет назад +5

    man you saved my semester

    • @akshaysolanki4340
      @akshaysolanki4340 4 года назад

      it's more than 5 years now,
      you're in a job now ??

  • @tech_voyager
    @tech_voyager 2 года назад

    You have no idea how helpful was that. Thank you so much for your work

  • @subashreddy4993
    @subashreddy4993 7 лет назад

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

  • @PeVoNZ
    @PeVoNZ 9 лет назад +1

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

  • @TheNPoet
    @TheNPoet 6 лет назад

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

  • @premkumarvasudevan6121
    @premkumarvasudevan6121 3 года назад

    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!

  • @shubhamthind8286
    @shubhamthind8286 5 лет назад

    Best video on BST deletion.

  • @haigangzhang8039
    @haigangzhang8039 4 года назад

    love your videos! I watch them every day!

  • @soumitadalal6130
    @soumitadalal6130 4 года назад

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

  • @vishalreddy3531
    @vishalreddy3531 8 лет назад

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

  • @clintonahong
    @clintonahong 10 лет назад +2

    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.

  • @nirmalaarunkumar
    @nirmalaarunkumar 2 года назад

    Simple and straightforward .Thank you!!

  • @nagaraju5433
    @nagaraju5433 8 лет назад

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

  • @moomenaldahdouh
    @moomenaldahdouh 6 лет назад +6

    for (i=0 ; i < inf ; i++){
    System.out.println(" Thank you ");
    }

    • @qR7pK9sJ2t
      @qR7pK9sJ2t 5 лет назад +2

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

  • @1gouravgg
    @1gouravgg 10 лет назад +11

    and there goes one more excellent video..

  • @vladn.2332
    @vladn.2332 6 лет назад

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

  • @Iamhere-em2us
    @Iamhere-em2us 6 месяцев назад +1

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

  • @RajSehmi5293
    @RajSehmi5293 5 лет назад

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

  • @pavittarkumarazad3259
    @pavittarkumarazad3259 4 года назад

    Never stop making videos! You are awesome :)

  • @hangchen6131
    @hangchen6131 7 лет назад

    Best BST delete video on youtube... or probably across the internet, at all time.

  • @ankitmathur1962
    @ankitmathur1962 10 лет назад +38

    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

    • @mycodeschool
      @mycodeschool  10 лет назад +152

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

    • @ScrappyVids
      @ScrappyVids 7 лет назад +9

      people are hungry for knowledge :p

    • @Toopa88
      @Toopa88 7 лет назад +1

      ankit mathur I hope he will upload a spelling video too.

  • @ch_se990
    @ch_se990 Год назад

    The best course ever thaaaaank youuuuuu so much 🙏🙏🙏🙏

  • @bishwajeetbal8685
    @bishwajeetbal8685 2 года назад

    This video was a saviour for me ❣️
    Thanks a lot

  • @Avighna
    @Avighna Год назад

    You are amazing at explaining this, keep it up!

  • @irfashaw1989
    @irfashaw1989 3 года назад

    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 👌

  • @vu5700
    @vu5700 4 года назад

    Very well explained sir,i wish you luck in your life

  • @akshattiwari2705
    @akshattiwari2705 5 лет назад

    Cleared my concept in last minute ... You owe me man.

  • @chloekimball536
    @chloekimball536 6 лет назад +94

    This is amazing. Do tutorials on AVL trees, B Tress and hash tables. Please, pretty please?

    • @adityaatri2053
      @adityaatri2053 5 лет назад +2

      @@amitdutta5610 Harsha SuryaNarayana , one of the best coder that India has ever produced.

    • @shivammehta8284
      @shivammehta8284 5 лет назад +2

      @@adityaatri2053 the humblefool

    • @shamanthakrishnakg1978
      @shamanthakrishnakg1978 5 лет назад +3

      He is not alive .

    • @Amitsa299
      @Amitsa299 5 лет назад +14

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

    • @rohankumar-of5qe
      @rohankumar-of5qe 5 лет назад +3

      Brother unfortunately he is no more..!!

  • @ewertonal
    @ewertonal 4 года назад

    This man is my savior

  • @gauravbharti5390
    @gauravbharti5390 4 года назад

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

  • @shahreazneeloy2119
    @shahreazneeloy2119 7 лет назад

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

    • @VermaAman
      @VermaAman 6 лет назад

      because that function will return the NODE with minimum value(i.e., it'll have data, left and right).

  • @vivek_1300
    @vivek_1300 Год назад +1

    what a nice explanation sir

  • @monumurari2876
    @monumurari2876 8 лет назад

    all your concept explanation is awesome sir

  • @AzureSupremuZ
    @AzureSupremuZ 3 года назад

    Great tutorial. Makes so much sense now.

  • @jakeharding8528
    @jakeharding8528 7 лет назад +5

    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

  • @sanjitpaul2953
    @sanjitpaul2953 4 года назад

    Great Sir. Very lucid explanation.