Binary Tree Bootcamp: Full, Complete, & Perfect Trees. Preorder, Inorder, & Postorder Traversal.

Поделиться
HTML-код
  • Опубликовано: 1 фев 2019
  • Code & Problem Statement @ backtobackswe.com/platform/co...
    Free 5-Day Mini-Course: backtobackswe.com
    Try Our Full Platform: backtobackswe.com/pricing
    📹 Intuitive Video Explanations
    🏃 Run Code As You Learn
    💾 Save Progress
    ❓New Unseen Questions
    🔎 Get All Solutions
    Full Binary Tree: Every node (besides children) has exactly 2 children (the maximum children a node can have in a binary tree).
    Complete Binary Tree: Every level, except possibly the last, is completely filled, and all nodes are as far left as possible.
    Perfect Binary Tree: All interior nodes have two children and all leaves have the same depth or same level. Perfect binary trees are both full and complete.
    Preorder Traversal: node left right
    Inorder Traversal: left node right
    Postorder Traversal: left right node
    ++++++++++++++++++++++++++++++++++++++++++++++++++
    HackerRank: / @hackerrankofficial
    Tuschar Roy: / tusharroy2525
    GeeksForGeeks: / @geeksforgeeksvideos
    Jarvis Johnson: / vsympathyv
    Success In Tech: / @successintech
  • НаукаНаука

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

  • @BackToBackSWE
    @BackToBackSWE  5 лет назад +88

    Table of Contents:
    A Quick Message 0:00 - 0:31
    What We Are Going To Do 0:31 - 0:52
    Full Binary Trees 0:52 - 1:38
    Complete Binary Trees 1:38 - 2:14
    Perfect Binary Trees 2:14 - 3:18
    Let's Discuss The 2 Fundamental Traversals 3:18 - 3:42
    How To Know Which Traversal Is Which 3:42 - 5:05
    Think of Recursion Like This. 5:05 - 5:33
    Preorder Traversal Walkthrough 5:33 - 11:15
    Inorder Traversal Walkthrough 11:15 - 14:25
    We Realize That This Is A Special Tree 14:25 - 15:07
    Postorder Traversal Walkthrough 15:07 - 18:59
    Briefly Addressing Time Complexity 18:59 - 19:22
    Wrap Up 19:22 - 19:40
    At 1:42 I meant that binary heaps are complete binary trees with the heap ordering property. Not that a complete binary tree is always a heap.
    The code for the traversals is in the description. All recursive and basically the same function. We will do iterative and O(1) space traversals soon.

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

      The ToC and video itself are perfect! The quality of information is phenomenal, I'm glad I kept digging for pre/in/post order examples until I found this! Thanks for taking the time to create this!

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

      ye, for the internet yo

  • @bonniwanamaker6296
    @bonniwanamaker6296 5 лет назад +496

    This guy is an amazing teacher.

    • @BackToBackSWE
      @BackToBackSWE  5 лет назад +20

      i try :*)

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

      Yeah for real I love his enthusiasm

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

      Jesus Christ is God and is the only way. Hell is real whether you believe it or not

  • @JossinJax
    @JossinJax 4 года назад +156

    Omg writing "lnr" at each node really clear this up for me. Thank you!

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

      nice

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

      Ikr I loved that!

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

      I am a software engineer for 2 years and I didn't know that. Let me go sell my degree ...

  • @alexandergonzalez5975
    @alexandergonzalez5975 4 года назад +221

    This channel is a shiny gem among a sea of low quality CS channels. Please keep it up.

  • @swimmingbyrd6283
    @swimmingbyrd6283 4 года назад +65

    Showing these traversal with a "n" saved my lllliiiifffffeeee!!!!

  • @Moitaytay
    @Moitaytay 4 года назад +21

    I've gotta say; I've worked at Amazon and Lyft, where you'd think people have their fundamentals down like crazy, but they can't explain simple topics like these. You, sir, have the gift of teaching. Thanks for your help!

  • @sunnypatel1784
    @sunnypatel1784 3 года назад +10

    Your reaction to the cutting and the stomping sounds cracked me up! Great content man! You just got yourself a subscriber.

  • @MM-lo9tk
    @MM-lo9tk 3 года назад +4

    I always assumed this was a super complicated topic and have been putting it off as long as possible. You just made it so simple and easy to understand. Thank you. I think I just found my new favorite channel!

  • @prashmokk6659
    @prashmokk6659 2 года назад +13

    This video was amazing. I don't really comment on videos, but I had to express my appreciation to you for creating this. I got an interview about a month ago and this was the first of many videos I watched of yours while I was preparing. This past week I found out that I got the job and you were a big part of that. I'm not sure if you'll see this, but I hope you know that your videos have helped me and many others. Please continue to make awesome informational content like this!

  • @MikeChaseJr
    @MikeChaseJr 4 года назад +5

    This is amazing. One of the better CS videos. I love how you ask questions to test our understanding as we watch!

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

    I have watched dozens of similar videos, I can tell you, this guy is amazing. The way he provides the material is unbelievable, so motivated, so much energy, so much positive things can be felt.

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

    Wow! the best video I have ever seen!. I have been trying to understand this for so long. No one really explained it in a format that made sense to me. This makes so much sense!. Thank you !!!

  • @gloriawang7493
    @gloriawang7493 11 месяцев назад

    thank you for such a high-quality video. your explanation of "each node needs to execute the same policy" makes a ton of sense! never have i understood traversal so clearly until your video!

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

    This is exactly what I needed! Thank you so much! You have no idea how hard the summer quarter has been with the lack of explanation.

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

    This is the most fantastic, clear video I have ever seen on DFS traversals, thank you so much my dear angel!

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

    This was really helpful. My university lecturer did a terrible job explaining this, but you managed to do it so succinctly and clear. Thank you!

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

    The best traversal video till now. You teach using first principles. Hats off !

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

    lnr at every node just made things so clear for me .....This is just amazing!!!

  • @crewelghoul
    @crewelghoul 4 года назад +14

    I've been struggling with data structures and algorithms, and this really made things a lot clearer, thank you so much!

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

    The way you explained the recursion is class apart!!! Also how to identify pre/in/post order. Hats off. Will now search for your video on graphs! Hope you have it.
    Keep posting!

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

    Honestly, You did a wonderful job explaining this content! It was fun, easy to follow and understand! 5 Stars! I did watch all of it, and I shall continue too watch all your videos! You rocked it!

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

    Great stuff my friend! Way you use NLR, LRN, NRL is simply beautiful. Few minutes and I got to understand how binary trees are traversed! Thank you!

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

    best explanation ive heard, very intuitive (I've previously gone through the topic in two separate modules and didnt really get it so this was great help)

  • @birbx3r354
    @birbx3r354 3 года назад +2

    I struggled with data structures and algorithms for 4 years. Watching your vids has helped me finally understand what's actually going on in layman's terms. Thank you so much for making these videos and keep it up!

  • @FracturedOctopus
    @FracturedOctopus 10 месяцев назад

    Quality breakdown. Simplified, easy to understand. Much gratitude! Man, even very easy means of memorization. Fantastic.

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

    I never understood this in class, however after this video I've learned how to correctly implement it and view it from a conceptual standpoint. Great video!

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

    Best channel out there. They way you explain things, it really shows how you yourself experienced learning these topics.
    And Im glad to have found this channel. Big ups from Germany.

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

    Wow, I was struggling to visualize recursion for months. This cleared it up for me! Thank you!

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

      Amaze! Try our 5 day free mini course for some fascinating content - backtobackswe.com/

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

    WOW. Watched a bunch of videos by different people on traversals, everyone else just mumbles on and on "print this, skip this and print that" without explaining why, and you're THE ONLY ONE who actually explains the whole recursion thing in detail. THANK YOU SO MUCH!

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

    I never comment on videos I see, but this one has to be the exception, because this is by far the best video I have seen on this topic. It cleared up so much confusion, and gave me tools to use along the way. Thank you!

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

    Dude, you just made it so simple to understand, thank you so much! You're an amazing teacher, I get it now

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

    this helped me a bunch for my collage exam, thank you!

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

    Absolutely well explained. I am watching this before my google interview tomorrow. Thanks a lot! Subscribed!

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

    you're amazing. I just started learning data structures in C and this is one of the best explanations i've found of binary trees..

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

    Amazing content and teaching!! Gained so much knowledge in 20 mins than i could in my whole semester!! Please continue making such quality content on DS&Algo!! Thank you Ben.

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

    I have never commented on a RUclips channel before, but you sir, are an amazing teacher. 🤗 Thank you so much, lots of praise for you from the Namibia University of Science & Technology!

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

    This video is VERY helpful in understanding recursion. I honestly brute forced recursion and never thought of it that way. As someone mentioned in the comments, this channel is a one-in-a-million!

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

    This explains tree traversal and recusion so clearly! Truly appreciate you sharing this information!

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

      Thank you, glad you liked it 😀
      Do check out backtobackswe.com/platform/content
      and please recommend us to your family and friends 😀

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

    half way through the explanation and really loved the nlr for each node! Hopefully now I can try to write logic on my own for tree problems. Fingers crossed!

  • @tajahouse4678
    @tajahouse4678 3 года назад +2

    This is AMAZING! And I laughed so hard at *LOUD CUTTING NOISE*! (Probably means I need to come out of my office for a bit lol) I for sure will be using this content for preview of whatever I am learning. Great work!

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

    I have looked at so many videos to understand this. This is the first video that made me understand it:) The recursive way of thinking was really helpful to understand this

  • @alexbowen3381
    @alexbowen3381 4 года назад +5

    Thank you so much for this video!! I'm an MIS major and a former CS major and after a so many CS courses a 20 minute video by you finally made me understand traversals! You are great at explaining these concepts and I look forward to binging more of your lessons as I brush up for some SWE interviews

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

    5:24 explain very well on nlr (Preorder) traversal on each node, plus recursion in general

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

    had a basic understanding before, your explanation sealed it for me, also patched up a concept i missed..Keep going 👍👍

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

    Man, I wasn't being able to understand tree transversals properly until I've seen your explanation. Thanks a lot! Now I understand!

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

    Using LNR as the call stack just help me understood how binary trees work in general. Thumbs up man

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

    Awesome. I came from a great CS book I'm reading and the chapter I'm right now touched this topic, so I came here for more info and wow. You helped me to understand it so much better! Keep it up! This channel is awesome

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

    to the point and straight! thank you! in preparing for my qualifying PhD exam and i just arrive after work and come to starbucks to study! i dont have enough time to read allthings in book carefully so thats the reason this video save much more time for me! tnx again! :)

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

    Hey. Just wanted to thank you for the content. You're clear and concise in your explanation which helps a lot.

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

    best explaining I've seen so far. Thank you so much!!!

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

    Sir, thank you very much for this video! Wherever you are, I hope you are safe and feeling well. You made me analyze this in the simplest way possible! I am very grateful to you sir. Thank you so much!

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

    OMG thank you for breaking this down. I was really confused before this video.

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

    Your videos are great man. I love your explanations and your examples. They're concise and straight to the point. Keep them coming buddy!!

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

    You explanation to recursion is amazing!

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

    It’s hard to keep up and stay motivated with online classes, so I started slacking off in my data structures class. Thanks to you, I feel like I’ve caught up and I feel ready for my midterm on wednesday 😼

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

    One of the best explanations for Binary Trees.Subscribed!

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

    That is what I was searching...keep making videos brother...you deserve our love. :D

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

    Thank you. 20 mins well spent!

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

    first time I ever subscribed to a channel after watching just 1 video, you have a great teaching style!

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

    Really sweet explaination with humoristic slices) It's gorgeous. Thank you!)

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

    this is exactly what I was looking for, thank you!! top notch explanations

  • @matthewpourroy1342
    @matthewpourroy1342 5 месяцев назад

    BY FAR the BEST explanation ever, thank you!!

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

    Superb job clipping this all together

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

    Thank you so much for the in-depth explanations you provide! I am very grateful to this channel! Thank you so much!

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

    dude, your explaination helps me retain the information so much better than other tutorials. writing the policy on each node is a really good trick for a visual learner like me. Thanks

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

    Thanks to you! I am able to submit my project because of your video!

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

    Turn this one up! You're a great speaker and break down concepts so well.

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

    this is absolutely fire finally understanding tree traversal thanks mate

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

    Bachelors in CS, 3 YOE and this is the firs time I understood recursive tree traversal! thank you!!

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

    Thanks to your channel... It really changed on how I see the traversal works, I understand it better and I hope I can pass my midterm exam on this topic. Thanks dude

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

    High quality and informative content. A must for conceptual clarity and interview prep.
    Thanks a lot for all the work !

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

    Thank you Benyam. The way you teach and explain is really awesome. I've really learned a lot from you. This video is special for "lnr" concept. Thank you again.

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

    Man this is the best explanation of tree order/recursion that I've seen great job!

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

      Thank you, glad you liked it 😀
      Do check out backtobackswe.com/platform/content
      and please recommend us to your family and friends 😀

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

    Keep it up! Got to go back to the basics sometime and I really need this. Thanks!

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

    after three years I finally understand tree traversal properly T_T , THANK YOU

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

    Finally a decent explanation on tree traversal, thank u

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

    Dude I wanna say that you are really impressive. This subject really made me confused but with your teaching style that shit became more understandable. Thx so much.

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

    This was just what I needed! Thank you so much for all you do.

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

    Studying for an interview next week, wasn't a CS major. OP, you're an awesome resource!

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

    Dude, this is seriously so helpful. You explained it well and got right to the point. Keep it up

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

    This was very helpful for my A-Level CS, thank you

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

    Straight to the point and great breakdown - thank you!

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

    Absolute hat's down. The teaching style is unique and I love it.

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

    I finally got it! you are an amazing teacher. Thank you so much!

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

    man, you've got some intense energy, i love it.

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

    To be honest, you way of teaching is as clear as crystal, loved it ...

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

    Super helpful and helped me knock out my assignment in class in no time and will help me remember these concepts long term. Thanks for making these resources :)

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

    Awesome! Thanks for this video. I was just attempting a leet code problem where I had to traverse a binary tree and I was pretty lost. You're a great teacher!

  • @ManojKumar-qe5dd
    @ManojKumar-qe5dd 4 года назад +1

    This channel is One of its Kind ! Great Job.

  • @travissimelane1847
    @travissimelane1847 2 месяца назад

    I don't know how to thank you. You have saved me hours of reading a Data Structures Textbook 3 times just to get this concept. Very thankful. Please do not stop your great work

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

    I like how he teaches it so passionately. It was super helpful! awesome!!!

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

    Love your enthusiasm pal. Thanks for great video

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

    The quality of this material is beyond what we deserve THANK YOU SIR

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

    The only person with charisma to teach Data Structures, I love it! (mosh is also good but you are pure gold)

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

    Thanks you man, great explanation. I have been a programmer for 11+ years, but never attended software engineering classes, just self taught, this videos help me a lot.

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

    It helps a lot when I tried to understand the Tree traversal, huge thanks!

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

      We have always got your back!! 😀
      Do check out backtobackswe.com/platform/content
      and please recommend us to your family and friends 😀

  • @ocholol
    @ocholol 4 месяца назад

    Your channel is carrying me in my CS class rn, tyty.

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

    Bro, you are the be(a)st, very intuitive explanations. I am not a cs major, but I can follow you very well. Please keep up the good work.

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

    Great video. You completely changed how I thought about the 3 common ways to traverse a BST. Thank you!

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

    This is Gold! Thanks mate!