Binary tree traversal - breadth-first and depth-first strategies

แชร์
ฝัง
  • เผยแพร่เมื่อ 21 พ.ย. 2024

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

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

    10 years later and there is no other video that explains this topic as intuitively as this guy did..Kudoss to thiss guy💪🔥

  • @ahrik-7
    @ahrik-7 6 ปีที่แล้ว +189

    Dude, you're like one of the few people I'd comment on.. your work is amazing. You've brought insane amount of clarity to each concept.

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

      He is dead... man. In road accident.

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

      @@JangBahadur3028 the speaker is not dead, but sadly his mate is. Rest in peace!

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

      ​@@JangBahadur3028really?
      Loss is incomparable 😭

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

    Life is full of circles!! Few years ago in 2020, I was watching your video to get my first job in college placement and now here i am again!!

  • @dhillaz
    @dhillaz 6 หลายเดือนก่อน +2

    Excellent lesson. Related Leetcode exercises:
    144 - Binary Tree Preorder Traversal
    102 - Binary Tree Level Order Traversal

  • @yosuanicolaus
    @yosuanicolaus 2 ปีที่แล้ว +9

    Thank you very much for your explanation on DFS! Understanding about DLR, LDR, LRD really just makes everything 100x simpler.

  • @altechy7304
    @altechy7304 3 ปีที่แล้ว +10

    There are people who teach, because they hold a degree, and that degree allows them to do what ever they want. And there are people who have actually the skill of teaching a special subject. Few Universities in the US have skilled teachers...
    Thank you so much for sharing your expertise with the world!

  • @MhZnSO4
    @MhZnSO4 8 ปีที่แล้ว +159

    The level of clarity in concepts i gain after your watching videos is PHENOMENAL!
    Keep up the good work.
    Open up some portal where willing people like me can give some money to your efforts.

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

      I agree. Often it's hard to find people who teach things in such a precise and clear manner. I remember when I first started programming in C from Java, the concept of pointers absolutely threw me through a loop and the common explanation of "It's just like a reference in Java!" didn't cut it, mcodeschool's lesson on pointers had excellent examples and helped grasp the concept perfectly!

    • @Ankit-mq6em
      @Ankit-mq6em 6 ปีที่แล้ว +1

      Animesh Nayan sir you are great and can be leader in whole india if you open your online courses as well as offline institute sir .You will rock and beat all others easily

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

      @rocky rawlo Bro he is alive his cofounder Harsh Surnyan is no more

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

    These videos are way clearer than my engineering school's courses
    THANK YOU SO MUCH MAN YOU'RE THE BEST

  • @ribaker822
    @ribaker822 7 ปีที่แล้ว +21

    You have got unusual clarity and insight into the concepts you teach. People like you are a breath of fresh air in CS. Thank you for deciding and taking time to do these series!

  • @mohbob
    @mohbob 10 ปีที่แล้ว +16

    Honestly believe your teaching standard is THE best I've come across !! I'm from london UK but currently wishing I was in India just so I can study in your boot camp !

    • @mycodeschool
      @mycodeschool  10 ปีที่แล้ว +5

      Mohbob Ali Thanks a lot :)

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

    Your preorder inorder postorder explanation is fantastic that cleared my intrinsic confusion.

  • @nickorefice7323
    @nickorefice7323 7 ปีที่แล้ว +10

    Thanks for the upload! The coloring of nodes during traversal really helped with my comprehesion

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

    Hahaha, I have never seen an explanation so clear, step-by-step. There is no space for doubts in between. It's a piece of "for dummies" mastery. Thanks

  • @joeybing3476
    @joeybing3476 9 ปีที่แล้ว +11

    best set of tutorials I've came across. outstanding!

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

    One of the best explanations I have ever seen on TH-cam.

  • @addadd8784
    @addadd8784 4 หลายเดือนก่อน

    thank you. easy to follow and great visuals. 10 years on and this is still great.

  • @akhilgupta3664
    @akhilgupta3664 4 ปีที่แล้ว +3

    The concepts after watching these videos are reached at hight level.
    After watching your videos , I feel confidence in that particular topic.
    Thanks Sir !!

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

    After watching this video I thought this is a one of the best channel I recommend for learning data structure easily... Thanks a lot for the explanation

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

    I am watching your video's from couple of days and i haven't watched anything better than this. You are really helping people to understand real concepts. No noise. Gr8!. Please continue and help people.

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

    The best explanation across the internet

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

    Please i recommend everybody to see all his lectures. THey are better than any college teacher :o THANK YOU So MUCH SIRRRRR

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

    Ita still relatable even now .Thanks for such an amazing explaination😀

  • @rbsupercool
    @rbsupercool 10 ปีที่แล้ว +33

    who the heck dislikes this videos... these are the best..

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

    I was in 6th class when this video was uploaded ,now i am in my 3rd year b.tech

  • @tanminator_
    @tanminator_ 9 ปีที่แล้ว +7

    You guys just keep saving me time after time!!!! Great work. :)

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

    Why did you stopped making videos? We need a hero like you to understand these concepts clearly.

    • @0x1h0b
      @0x1h0b 3 ปีที่แล้ว

      It's a very sad story actually, i found out while reading one of his interviews on why he stopped making videos.........initially they were 2 friends who started making videos and unfortunately one of them passed away, he had an accident or something... after that videos very less frequent and eventually he stopped making videos ..now he focuses more on his family and full time job....that's all i know

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

    Agree its difficult to manage youtube.....but still you can do a live stream to chat with your students.....and share feelings with us....that would be great

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

    You are the best professor ever! Thank you so much for posting videos

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

    You guys are doing great job!! keep it up, your explanations is far better than any book or lectures, concise and simple !!

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

    Best tree traversal explanation.

  • @ajinkya90swim
    @ajinkya90swim 10 ปีที่แล้ว

    I love this guy!!! very clear and systematic approach.

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

    OMG I FINALLY GET HOW TRAVERSAL WORKS. THANK YOU!!!!

  • @alexdesouza140
    @alexdesouza140 9 ปีที่แล้ว +4

    Outstanding explanation like all of your other videos.. thanks for your hard work !!!

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

    you explain it so well, thank you :)

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

    this has to be the best explanation. 🥺

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

    As in.. This explanation is superb and uncomplicated like those the school lecturer gave

  • @ChauNguyen-nb5so
    @ChauNguyen-nb5so 5 ปีที่แล้ว +1

    Your videos are so helpful with all the concepts in my Data Structure class. Thank you so much

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

    your this video helped my exam preparation

  • @nesliemmanunday3682
    @nesliemmanunday3682 ปีที่แล้ว +10

    I was here from TOP.

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

    this was a very well made video, concise and well explained. Thumbs up .

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

    This was just wow 🙏 Very clear explanation

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

    Awesome video, thanks for uploading this

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

    Can someone please explain why Inorder traversal of a binary search tree gives a sorted list? at 11:27 the list has the order G H I. now I is definitely greater than G. but both G and H are smaller than I, so how come G is before H necessarily? It could be reverse also?

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

    Whats your name buddy? ..your videos are the best I have ever seen.. the way you explain and use diff colors and how overall video is made.. great work.. thanks a ton!

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

    Really fantastic clarity! Thank you so much!

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

    Very understandable... Thank you

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

    Inorder traversal only gives the sorted list if the tree is Binary Search Tree, a very important thing to remember.,

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

    This video was amazing, well done!

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

    Excellent visualization but why didn't you post the link to the next one?

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

    Great tutorial, do you have anything for node deletion?

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

    Well, that's one more of your videos that makes it to my favorites... Again. 😁

  • @davezhang8314
    @davezhang8314 10 ปีที่แล้ว +2

    excellent video, i really appreciate your method of explanation.

  • @quantum_yt4790
    @quantum_yt4790 10 หลายเดือนก่อน +1

    nice explanation

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

    Excellent explanation!

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

    Amazingly clear video, Thank you!

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

    Hi, Thanks for the explanation. Its very great explantion... thanks again

  • @folksgames7047
    @folksgames7047 8 ปีที่แล้ว +3

    Very helpful, thank you!

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

    post order traversal of the tree should be A,C,B,E,D,H,I,G,K,J . at 11.49 last two node is reversed.

  • @terryparrish6763
    @terryparrish6763 9 ปีที่แล้ว

    Very good example!!! I really was able to follow. Thanks!!!!

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

    first of all,I have been watching your videos and they are really helpful thank u for that.
    I just have question
    so for traversing the tree in depth-first or breadth-first , the time complexity is O(n) because I have to visit every node on the tree
    what about the space complexity for depth-first and breadth-first..?
    thanks in advance.

    • @mycodeschool
      @mycodeschool  10 ปีที่แล้ว +2

      nabil muthanna : space complexity will be O(n) in worst case and O(log n) in average case for depth-first. For Breadth-first , space complexity will be O(n) in average case. So, depth first is efficient in terms of memory consumption. I'll explain space complexity analysis in detail in coming. lessons.

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

    Very nicely explained, thank you!

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

    Awesome explanation!

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

    Thank you. I can answer my exam tomorrow.

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

    amazing algorithms

  • @KnightVsMinecraft
    @KnightVsMinecraft 8 ปีที่แล้ว +3

    Thanks :) very helpful

  • @Sam-oc7nm
    @Sam-oc7nm 9 ปีที่แล้ว +2

    Man, you are the best!!!!!! thank you so much!

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

    you just broke the concept men!

  • @ManishKumar-qx1kh
    @ManishKumar-qx1kh 7 ปีที่แล้ว +1

    Sir can you upload videos on heap tree please.

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

    thank you so much..which software did u used for this tutorial..?

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

    thank you, very helpful dood

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

    Thanks a lot sir! for making such an awesome video.
    Clarity of Concept->Excellent
    Sir,I have a doubt can u please tell me tree programmings are more efficient in C/C++/Java.
    I have followed all of your lectures.

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

    Thank you for your help!

  • @arush2323
    @arush2323 10 ปีที่แล้ว

    sir, we all are waiting for your up comming videos...please be quicker.. :D
    and BDW I just love the way you teach...keep these amazing videos comming...

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

    I know I'm like 7 years late to the party, but for anyone who can't remember preorder, postorder and inorder, think of it like this:
    The convention is always to read Left child before Right child.
    Preorder: Root is "pre"-read to Left and Right. Pre meaning before. That is, root > left > right.
    Inorder: Root is "in (between)" Left and Right. That is, left > root > right.
    Postorder: Root is read "post" Left and Right. Post meaning after. So, that would be, left > right > root.
    Hope it helps some random stranger.
    And btw, I'll give the credit for this "mnemonic" to Jenny from Jenny's Lectures. I watch both her and mycodeschool's videos to get a good understanding of the concept and the algorithm.

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

    superb as Feynman

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

    Awesome! How do you record these videos? What are you using to write and highlighting and stuff? Looking forward.

    • @R9000S
      @R9000S 9 ปีที่แล้ว

      +Ahmad Awais just checked out ur cool website. and dang u have a lot of twitter followers

  • @ordinarycoder8090
    @ordinarycoder8090 9 ปีที่แล้ว

    great explanation

  • @deveren
    @deveren 7 หลายเดือนก่อน +5

    from odin!

    • @noice1006
      @noice1006 4 หลายเดือนก่อน

      Same

    • @deveren
      @deveren 4 หลายเดือนก่อน

      @@noice1006 wish ya luck keep it up

  • @harithabandara3212
    @harithabandara3212 8 หลายเดือนก่อน

    Thank you very much!♥

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

    Outstanding!!! Thank you

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

    I tried to figure out the value in Postorder traversal, mine is A,C,B,E,D,H,I,G,K,J,F.
    CMIIW

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

    kindly provide the video transcript of your lectures as provided by coursera

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

    You taught better than my teacher.

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

    is that me doing data structures so well !!!

  • @koustavannu
    @koustavannu 10 ปีที่แล้ว

    just luvd it. teaching style z just awesome. very much helpful...!!!!

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

    *Sir u should write a leacture number..it will be helpful*

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

      Lol this channel died because his friend died and now he is back to working at microsoft sad!

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

    Is it possible to do inorder or postorder traversals in BFS?

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

    Woderful ! Thank you.

  • @bbs-3358
    @bbs-3358 4 ปีที่แล้ว +1

    so the Post Order in the video is correct?. And inorder - how come is G, H, I? why is it not H, I , G , J, K? ** can someone explain to me :(

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

      try to visualize the each node and left subtree and right sub tree and solve each sub tree with the order

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

    Is preorder, inorder, postorder only applicable to DFS? I'm confused by the wording from your video. Do we not use those 3 orders for BFS?
    Thank you

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

      Yes, in BFS there is no preorder, inorder and postorder because we just traverse from left to right in each level until the tree is done

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

    Thanks so much for it! 🔥

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

    And when it have cycle (be a binary or any kind of tree, for example in that Arad to Bucharest map example) how the breadth-first and depth-first search behave?? could i put the repeated leaf node again? Thanks!!

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

    Thank you sir.

  • @ArifA
    @ArifA 9 ปีที่แล้ว

    If the height of left sub-tree and right-tree are same, then what would be the return value from max function?

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

    Great Stuff!

  • @raffy3304
    @raffy3304 10 ปีที่แล้ว

    Please make a vid tut on how to draw tree from pre,in and post traversals? thanks

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

    You mentioned a word starting with "c" several times in the 1:50-2:10 time frame and I cannot understand what you're saying. It sounds like "craft" and that's how it's being interpreted by the auto closed captioning. What is this word? Thanks.

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

      Are you saying "graph"?

    • @mycodeschool
      @mycodeschool  10 ปีที่แล้ว +26

      Gary White Yeah, I am saying "Graph". May be I need to upload subtitle for this one. And I think "graph" would be pronounced properly moving on. :)

    • @garywhite8274
      @garywhite8274 10 ปีที่แล้ว

      mycodeschool Thank you

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

      @@mycodeschool when are you posting videos back on youtube

  • @hemantyadav1047
    @hemantyadav1047 11 หลายเดือนก่อน +1

    The only way to understand anything is to do it recursively. Just like dfs

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

    great video thank u

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

    Thank you