Trie Data Structure

แชร์
ฝัง
  • เผยแพร่เมื่อ 17 ก.ย. 2024
  • / tusharroy25
    github.com/mis...
    Insert, delete and search into trie.

ความคิดเห็น • 397

  • @anmoljawa8367
    @anmoljawa8367 4 ปีที่แล้ว +61

    I really really like the way Tushar explains things, not giving out the code, but just the understanding one needs for the problem . Truly appreciate your effort @Tushar

    • @RitikSingh-bt3gp
      @RitikSingh-bt3gp 3 ปีที่แล้ว

      Actually the code to the problem is in description box. But yes your point is commendable

  • @GokulRG
    @GokulRG 8 ปีที่แล้ว +158

    Bro.. You're the best tutor i know man.. Thanks a lot...

    • @Anubis10110
      @Anubis10110 6 ปีที่แล้ว +6

      Check Mr.Abdul Bari for Algorithms...He is More than Amazing..This guy is good too

    • @Yagamilight19383
      @Yagamilight19383 5 ปีที่แล้ว +6

      If he is the best tutor you know, you really need to see the world ...

    • @gauravruhela007
      @gauravruhela007 4 ปีที่แล้ว +5

      @@Yagamilight19383 stop comparing pagalo....

    • @tryler449
      @tryler449 4 ปีที่แล้ว +1

      ^^ This, Tushar is totally a friend.

    • @universeboss4865
      @universeboss4865 3 ปีที่แล้ว

      @@Yagamilight19383 200% true..., yeah he is good but not the best...

  • @lkez2
    @lkez2 7 ปีที่แล้ว +20

    Wow. I just want to say thank you from the bottom of my heart. You are an amazing teacher. And you have no idea how much making these videos means to me. Thank you again

  • @azeeztaiwo2802
    @azeeztaiwo2802 5 ปีที่แล้ว +6

    one of the best tutorials i have seen on tries.

  • @hehhehdummy
    @hehhehdummy 7 ปีที่แล้ว +4

    I think it's wonderful that you took the time to go over the code. I'm much more happy to see that you explained both the recursive and iterative implementations of the functions. Thanks so much!

  • @rajuathokpam
    @rajuathokpam 5 ปีที่แล้ว +3

    this is a great piece. i am revisiting this video today after a year again

  • @tanujabharti8043
    @tanujabharti8043 4 ปีที่แล้ว +1

    Trie was used to one of the nightmares for me...because of your video it becomes so easy...thank you :)

  • @umcanes2005
    @umcanes2005 5 ปีที่แล้ว +3

    Best walkthrough of Trie I have ever seen.

  • @shyam5631
    @shyam5631 4 ปีที่แล้ว

    It's 2020 and still this is best channel to learn data structures and algorithms.

  • @chintalapativenkataramarahul
    @chintalapativenkataramarahul 6 ปีที่แล้ว +17

    I cannot even say how thankful I am to you for making this video. Thank you very much! Great explaination.

  • @iamsurmeli
    @iamsurmeli 6 ปีที่แล้ว

    You are the best data structure & algorithms instructor I have ever seen in my life.

  • @liangbinchen2519
    @liangbinchen2519 4 ปีที่แล้ว +1

    Well I haven't went through all the videos about Trie yet but this is by far the best. Great work!

  • @rajmmehta495
    @rajmmehta495 4 ปีที่แล้ว

    Thank you so much Tushar literally watching your videos has helped me pass engineering and its still helping while working as a professional.

  • @alexitosrv
    @alexitosrv 8 ปีที่แล้ว

    Excellent explanation!! When I find algorithm descriptions like this I feel I can reconstruct the code any moment ever. Thank you.

  • @displacednaija
    @displacednaija 5 ปีที่แล้ว +2

    Wow, I know more about deep software system analysis in a few minutes of listening to this man than all my time interacting with devs in almost 6 years.

  • @ivandrofly
    @ivandrofly 5 หลายเดือนก่อน +1

    Thanks :) - I've learn trie before but needed a refresh

  • @anirudhraovasudevarao3211
    @anirudhraovasudevarao3211 7 ปีที่แล้ว +1

    By far the best explanation for trie data structure. Thanks a ton for this video. What makes this video unique is the usage of sample strings to explain , which cover the corner cases.

  • @KushBaronj
    @KushBaronj 8 ปีที่แล้ว +1

    Simple and to the point explanation . Thankyou so much, your videos are really help full.

  • @nimbalkarvicky9
    @nimbalkarvicky9 ปีที่แล้ว +1

    Great explanation. You missed to mark node "False" at 6:55, when inserting "d" value.

  • @cwash08
    @cwash08 8 ปีที่แล้ว

    Top notch. I've heard of trie but have never learned about it before.

  • @MichaelShingo
    @MichaelShingo ปีที่แล้ว +1

    great intro to tries thank you, now to try this leetcode problem in python...

  • @deepamgupta8011
    @deepamgupta8011 4 ปีที่แล้ว

    Great explanation @Tushar Roy

  • @andrewthmas
    @andrewthmas 3 ปีที่แล้ว

    You are a good teacher and a good Developer

  • @travellerpal4911
    @travellerpal4911 3 ปีที่แล้ว

    This guy is really amazing at teaching new concepts

  • @morampudiakhil516
    @morampudiakhil516 3 ปีที่แล้ว

    You have just made my day! Always feared of the word Trie, Now I feel very comfortable implementing it. Just Superb Job, Thanks

  • @raviagarwal4287
    @raviagarwal4287 4 ปีที่แล้ว

    Sir, your explanation is very clear and easy, your video helps me to understand this topic in a very easy way!!.
    Thank you😊

  • @ayushjindal4981
    @ayushjindal4981 5 ปีที่แล้ว

    Thumbs Up!!! The examples you take to demonstrate the concept are quite good

  • @soniamartis9849
    @soniamartis9849 8 ปีที่แล้ว

    excellent video on tries. Never understood tries before watching this video!!

  • @gloverelaxis
    @gloverelaxis 5 ปีที่แล้ว +4

    Thanks for your useful labour here Tushar! I'd recommend getting a "lavalier" or just "lav" microphone; they're the ones that you clip onto your shirt's lapel. It would help the audio quality a _lot_, and make following the explanations a lot easier for international people who only know English as a second language. Lavalier mics are also relatively cheap compared to other kinds of microphone.

  • @jaatharsh
    @jaatharsh 4 ปีที่แล้ว

    this is superb, can't thank you enough dude, keep on uploading such quality content.

  • @venkateswarank1145
    @venkateswarank1145 5 ปีที่แล้ว

    There is a small bug in delete method.
    It should be "return !root.isEndOfWord && root.children.size() == 0;".
    Else that would delete all prefixed characters as well
    Thanks so much Tushor for everything that you do for us

  • @jayeshudhani99
    @jayeshudhani99 3 ปีที่แล้ว +2

    Awesome video. However, there is one error in the code :
    While returning inside if(shouldDeleteCurrentNode) , it should be return current.children.size() == 0 && !current.endOfWord;
    Basically, if a word is ending at this node, then we shouldn't delete this node.
    Consider for example if we insert "jayesh" and "jay" in the trie and delete "jayesh", it would delete both the strings which is incorrect.

  • @cashlalala
    @cashlalala 5 ปีที่แล้ว

    This is really awesome, long live Tushar!!

  • @abhishek8263
    @abhishek8263 8 ปีที่แล้ว

    Thanks @tushar. Your explanations are very easy to understand. it really help to learn quickly.

  • @kamal-kp9wo
    @kamal-kp9wo 7 ปีที่แล้ว +5

    Thanks for the amazing video. You are doing a great job and I really appreciate your effort. Your videos helped me a lot.
    Although this is very trivial, I would like to point out that in the code provided,
    If there are "abc" and "ab" in the Trie, after removing "abc", the search for "ab" return false.
    Again thanks for the video.

    • @VikasSingh-eu6vk
      @VikasSingh-eu6vk 4 ปีที่แล้ว

      if (i == input.length()) {
      if (!current.endOfWord) {
      return false;
      } else if(current.children.size() > 0) {
      current.endOfWord= false;
      }
      return current.children.size() == 0;
      }

  • @xahraahmadi9207
    @xahraahmadi9207 3 ปีที่แล้ว

    its very good that you are at first explain then give a code its very good plz do that with other videos that you will be share

  • @iofirag
    @iofirag 5 ปีที่แล้ว

    This is the best video in youtube for Trie data structure i have found!

  • @maheshvshet
    @maheshvshet 7 ปีที่แล้ว

    Awesomely clear explanation. Thanks for sharing knowledge.

  • @Shades.of.life.by.Vandana
    @Shades.of.life.by.Vandana 5 ปีที่แล้ว

    explained in very easy way...very good Tushar

  • @AKASH-sw9bs
    @AKASH-sw9bs 4 ปีที่แล้ว

    thanks sir . such a elegant explanation , easy to understand , better then one on gfg.

  • @RagazzoKZ
    @RagazzoKZ 5 ปีที่แล้ว +1

    As always very helpful

  • @rohanthakrar7599
    @rohanthakrar7599 ปีที่แล้ว

    Thank you Tushar this is a great, well explained lecture

  • @DenisG631
    @DenisG631 8 ปีที่แล้ว +2

    Excellent! It doesn't get any better. Thank you for your explanation!

  • @starc701
    @starc701 4 ปีที่แล้ว

    Ek like to bnta hai tushar bhai k liye .sa b like kro bhai ka video

  • @Bala-go6cc
    @Bala-go6cc 8 ปีที่แล้ว

    Simple and superb explanation..thanks tushar roy!!

  • @ajr1791ze
    @ajr1791ze 4 ปีที่แล้ว

    best video on trie ever and forever.

  • @nagamass
    @nagamass 5 ปีที่แล้ว

    Excellent Explanation. at 16:37 in video, in Insert method, node = current.children.get(ch) NOT current=node; this will fail at every first character.

  • @shubhamsinghal6226
    @shubhamsinghal6226 7 ปีที่แล้ว

    Best Video to understand the concept in detail

  • @preeteesh5881
    @preeteesh5881 6 ปีที่แล้ว +1

    Very helpful. Thanks a lot.

  • @vaibskinikar
    @vaibskinikar 8 ปีที่แล้ว +2

    Superb explanation!! Was waiting for this video. Thanks so much for taking out time!

  • @arunvyas27
    @arunvyas27 8 ปีที่แล้ว

    Thanks a lot man, I have always stayed away from Trie but now after watching your video it seems so easy. :)

  • @sunpacksun2954
    @sunpacksun2954 4 ปีที่แล้ว

    Hello Tushar, I listen to your videos because I like your introduction "Hello Friends" Thanks for the videos

  • @PraveenGudivaka
    @PraveenGudivaka 8 ปีที่แล้ว

    Nice Explanation,
    I save lot time to me in understanding this data structer.

  • @kuanlin4171
    @kuanlin4171 8 ปีที่แล้ว

    Very nice explanation! It really helps me understand the trie data structure!

  • @QuinsonHonQBB123XX
    @QuinsonHonQBB123XX 4 ปีที่แล้ว +1

    This video has helped me a lot in understanding Tries. The concepts were well-explained and I was able to come up with my own implementation on C++ fairly easily. Thanks!

  • @gurpreettata
    @gurpreettata 4 ปีที่แล้ว

    great way to explain the topics. crystal clear

  • @lanpingdeng1094
    @lanpingdeng1094 4 ปีที่แล้ว

    Great video and code, now I am clear about the TRIE

  • @prajaktabelgundi6461
    @prajaktabelgundi6461 7 ปีที่แล้ว

    Excellent video for understanding Trie implementation ! Thanks a lot !

  • @yodamite1348
    @yodamite1348 4 ปีที่แล้ว

    Make inner class TrieNode Static so that it does not require an instance of the outer class to be used. Amazing video!

  • @sidhantakumarpattnaik2962
    @sidhantakumarpattnaik2962 8 ปีที่แล้ว +1

    waited for this video . Thanks so much ...

  • @GurpreetSingh-th1di
    @GurpreetSingh-th1di 5 ปีที่แล้ว

    best explanation on trie

  • @shubhamkhatri445
    @shubhamkhatri445 8 ปีที่แล้ว

    My trie is super clear after watching your video....thank you for creating this video:))....it would be great if you teach ternary search tree also...

  • @nouraa1258
    @nouraa1258 5 ปีที่แล้ว

    Thank you so much! This is the best tutorial on Tries. I really appreciate your efforts.

  • @yossi_cohen
    @yossi_cohen 8 ปีที่แล้ว

    You are a talent!!! good examples and excellent explanations

  • @metapoynter
    @metapoynter 7 ปีที่แล้ว

    Thank you very much @Tushar Roy for this tutorial. You really did a good job, explaining it clearly. I was able to do the coding challenge on HackerRank that is of difficulty level Hard very easily.

  • @calliart6586
    @calliart6586 4 ปีที่แล้ว

    Excellent.. Exactly like my notes

  • @shwetasingh7906
    @shwetasingh7906 2 ปีที่แล้ว

    Great video ❤️

  • @pixelpaxal
    @pixelpaxal 3 ปีที่แล้ว

    This is the best explanation of Trie, you really helped readers establish a proper mental model of this data structure and it’s implementation.

  • @caimgeo5009
    @caimgeo5009 6 ปีที่แล้ว

    Wonderful explanation and simple coding..

  • @tumul1474
    @tumul1474 4 ปีที่แล้ว +1

    nice explaination ! thanks

  • @PizzaAndEminence
    @PizzaAndEminence 3 ปีที่แล้ว

    Amazing explanation, thank you so much

  • @kraj2217
    @kraj2217 3 ปีที่แล้ว

    Awesome explanation. Thanks a lot!

  • @bmalhi3309
    @bmalhi3309 5 ปีที่แล้ว +3

    Hey Tushar,
    Once again great video and thanks for sharing with all. I had one doubt in delete the word in Trie as you are checking for current.children.size() == 0 which is not going to be true when you have 2 or more characters starting at root node. Eg: 'Alpha' & 'Beta' root Trie node will have 'A' and 'B' both at the root which means the currentmap.childred.size() will not be 0. Please share your thoughts about this. Thanks.

    • @romabogatikov2358
      @romabogatikov2358 3 ปีที่แล้ว

      I will leave it here in case anybody else stumbles upon this problem. We have to add one more check in this case (I use JavaScript):
      // return true if no mappings are left in the map and endOfWord is false
      return !current.endOfWord && current.children.size === 0;

  • @tishachoudhuri7082
    @tishachoudhuri7082 7 ปีที่แล้ว

    Great explanation Tushar dada! you make things simple for new programmers :)

  • @lorinbehringer3147
    @lorinbehringer3147 8 ปีที่แล้ว +1

    excellent explanation! your videos are really helpful

  • @tahanimachowdhury
    @tahanimachowdhury 8 ปีที่แล้ว

    Your explanations are very clear. Thank You for your efforts. Please make a video on Suffix Array.

  • @Bakepichai
    @Bakepichai 6 ปีที่แล้ว

    Beautiful explanation Tushar

  • @vamshiverama4712
    @vamshiverama4712 ปีที่แล้ว

    Hi @tushar.
    Code correction: delete method code has a small bug.
    private boolean delete(String word, TrieNode current, int index){
    if(index==word.length()){
    if(current.isEndOfWord){
    return false;
    }
    // if there are NO children, it will tell the parent to delete itself
    current.isEndOfWord=false;
    return current.children.size()==0;
    }
    char ch = word.charAt(index);
    TrieNode node = current.children.get(ch);
    if(node==null){
    return false;
    }
    boolean selfDelete = delete(word, node, index+1);
    if(selfDelete){
    current.children.remove(ch);
    *if(current.isEndOfWord==false){*
    return current.children.size()==0;
    }
    }
    return false;
    }

  • @abhimanyurewar2482
    @abhimanyurewar2482 5 ปีที่แล้ว

    siraa bai

  • @pilidvini
    @pilidvini 8 ปีที่แล้ว

    Very clear and simple explanation :) Thanks

  • @kishorguptha
    @kishorguptha 6 ปีที่แล้ว

    nice video. the videos which you present are really good..man..

  • @sreenathc
    @sreenathc 3 ปีที่แล้ว

    Excellent explanation. I think this would be so easy to implement in a functional programming language like Haskell...will have to try thst

  • @jaideepsingh7955
    @jaideepsingh7955 2 ปีที่แล้ว

    nice explanatory video

  • @pushkarnarayan597
    @pushkarnarayan597 8 ปีที่แล้ว

    Great tushar .. Keep it up

  • @jaishammirajkulkarni4845
    @jaishammirajkulkarni4845 5 ปีที่แล้ว +1

    best tutorial on trie.

  • @mohammedsadiq8178
    @mohammedsadiq8178 5 ปีที่แล้ว

    That code was really beautiful man! Awesome!

  • @abhijittripathy4169
    @abhijittripathy4169 7 ปีที่แล้ว

    Awesome explanation. Thanks a lot for your videos !

  • @ababbaba7600
    @ababbaba7600 7 ปีที่แล้ว

    Thanks Tushar, very good explanation.....video was very helpful!!

  • @叶子豪-t6g
    @叶子豪-t6g 7 ปีที่แล้ว +12

    I feel the highlighted line @19:31 should be:return current.children.size() == 0 && !current.endOfWord;Imagine this case:Insert("ab");Insert("a");Delete("ab"); Your code will also delete "a"?

    • @RahulSathe.07
      @RahulSathe.07 7 ปีที่แล้ว +1

      叶子豪 i just thought about the same scenario.. thanks to your comment, i was able to validate my understanding as well..

  • @missndshah
    @missndshah 4 ปีที่แล้ว +1

    I keep waking my computer screen when this video goes to a next section lol

  • @rahuldevmishra4558
    @rahuldevmishra4558 7 ปีที่แล้ว +2

    +Tushar Roy - Coding Made Simple - I have a question at 12:55
    Lets say, there is another word "cbc", which means that it will end at the node "c". Now we have two words '"abc" and " cbc". So when we delete the word "abc", we mark the node following "c" to false which would also delete "cbc". So how do we handle this scenario ?

    • @NitishSarin
      @NitishSarin 7 ปีที่แล้ว +2

      "abc" starts with 'a' and "cbc" starts with c, so they will have different starting paths from the base root node. This situation will never occur. both will have an ending 'c' node, but these will be two different and independant nodes.
      Hope you understood! :)

    • @rahuldevmishra4558
      @rahuldevmishra4558 7 ปีที่แล้ว

      + Nitisha Sarin - Thank you for the explanation.

  • @PaddyVicky
    @PaddyVicky 8 ปีที่แล้ว

    A good simple to the point tutorial. Thx

  • @gauravruhela007
    @gauravruhela007 4 ปีที่แล้ว

    Tushar bhai tussi great ho!

  • @user-vr2go1bj5b
    @user-vr2go1bj5b 2 หลายเดือนก่อน

    You are my life teacher

  • @akashchatterjee5179
    @akashchatterjee5179 6 ปีที่แล้ว

    Very good video

  • @MW-fm1qq
    @MW-fm1qq 4 ปีที่แล้ว

    Amazing explaining! Thank you so much!

  • @prathashukla6596
    @prathashukla6596 4 ปีที่แล้ว

    perfectly explained good job as always!

  • @partheshsoni6421
    @partheshsoni6421 4 ปีที่แล้ว

    Thanks a lot, Tushar!

  • @codetolive27
    @codetolive27 6 ปีที่แล้ว

    Awesome video!! Keep up the good work

  • @vjnvisakh
    @vjnvisakh 8 ปีที่แล้ว

    awesome man ... hats off to you