AVL Trees & Rotations (Self-Balancing Binary Search Trees)

Поделиться
HTML-код
  • Опубликовано: 5 июл 2024
  • 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
  • НаукаНаука

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

  • @yonathanmichael1910
    @yonathanmichael1910 3 года назад +197

    This kid's older brother is one of my little homies from college. Now i'm reviewing algorithms and the little little homie is teaching me. Both impressive young men who are making their families proud.

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

      haha hey

    • @WyMustIGo
      @WyMustIGo 2 года назад +12

      Looks like this homie stopped the videos because there is no money in teaching for free. That means he gained wisdom and is using his knowledge to make a profit instead... Homie is getting wise.

  • @TheAntloo
    @TheAntloo 4 года назад +297

    Hey man just realized I never actually thanked you, I passed my interview and your videos were so much help!!! You are awesome!

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

      great - flourish in life friend

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

      @TheAntloo, how many times have you used an AVL Tree in your job of two years? 🙂

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

    Check out the free DSA Mini-Course 👉backtobackswe.com/five-day
    Table of Contents:
    Introduction 0:00 - 2:07
    Tree Height 2:07 - 3:51
    Node Balance 3:51 - 4:21
    Balance Calculation Practice 4:21 - 7:32
    Breaking The AVL Property 7:32 - 8:32
    Rotations 8:32 - 12:52
    Right Rotation 12:52 - 15:58
    Left-Right Rotation 15:58 - 18:12
    Left Rotation 18:12 - 18:50
    Right-Left Rotation 18:50 - 19:44
    Support Us At backtobackswe.com 19:44 - 20:37
    Errors:
    0:19 - 1:41 The is not a BST, this is fixed at 1:41.
    11:08 NIT: The purple triangle is > y (strictly greater) and > x
    I hope this helps someone. If there are any mistakes let me know and I'll update the "Errors" section.

  • @weallgotwoodandnails
    @weallgotwoodandnails 4 года назад +13

    Clear, concise, and invaluable. Thank you for uploading this.

  • @arjunkashyap8896
    @arjunkashyap8896 3 года назад +18

    This is the clearest explanation I have seen on Balanced Trees so far. I was trying to learn this topic back in march and I could not find a good resource to understand and I dropped this topic. Now today I picked it back up and I found your video. Thank you so much !! ---> Subscribed

  • @abhinavsingh4221
    @abhinavsingh4221 4 года назад +10

    Just few moments ago I was really missing you and your content and now your video is here!! Welcome back buddy :)

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

    First time here.
    Was searching info about AVL, had problems with understandings it. And occasionally find this channel.
    Man it is incredible. Totally awesome. It's so clear for me after your explanation.
    I've also checked the list of your videos. And I am joining this great channel and will advise it to my friends!
    Thanks for the content!

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

    The clarity of your explanation is astounding. Thanks a bunch!

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

      Haha! thanks. Try out the free mini course on our website - backtobackswe.com/

  • @user-rq9kd7xu5x
    @user-rq9kd7xu5x 3 года назад +6

    Thank you for this video! finally I understood AVL trees!! I will keep commenting each video I see that helped me to keep supporting you! you are great!

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

    Before i watch the video again gotta let you know, this was hands down the best illustration ideo for AVL trees. The illustrations are easy to follow. Cheers.

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

    Perfect explanation of AVL rotation !! I've watched the videos about this subjet in French, Korean and English. And only your video makes me understand CLEARLY and PERFECTLY. Thank you so much.

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

      Glad it helped 😄 We also have a Free 5 Day DSA Interview Prep Mini-Course - backtobackswe.com/ 🎉

  • @amirPenton
    @amirPenton 3 года назад +11

    Started BSTs in class and we have to implement our own AVL tree. The textbook didn't cover left-right or right-left rotations nearly as well as you did. Thanks so much for this video, I will be citing this in my project.

  • @DanielDiaz-rq3ko
    @DanielDiaz-rq3ko 2 года назад

    I know this video came out awhile back but if you see this, thank you so much! I just didn't understand it in class and when my professor explained it again to me. You literally made this such an easy concept to get!! Thank you !!!!

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

    OMG the way you explained it around 12:30 makes so much sense. I don't need to memorize anything, I just need to think through whether each triangle is less than or greater than x, and the same thing for y, and then it's so easy to perform the rotation. Thank you!

    • @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 :)

  • @Happy.Vagabond
    @Happy.Vagabond 3 года назад +49

    Hey you probably get this a lot, but you helped me so much to prepare for my interview. I have been non-stop preparing for my coding interview at my dream company at Microsoft. I've been prepping 8-10 hours a day every single day on LeetCode and watching your videos. You have helped me so much in learning the fundamentals and learning how to approach different coding problems. I'm glad to say that I did get an offer from Microsoft yesterday! Again, I thank you so much. Your videos were the main reason I was able to get this offer. You have truly changed my life.

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

      great to hear. grow strong.

    • @user-jx7ef2nv3u
      @user-jx7ef2nv3u Год назад +2

      hey! im new in coding, can you explain me how did you prepare and any advices for beginers like me? i would appreciate a lot!

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

    I got a Microsoft SWE II position from your awesome videos! Thank you so much for your videos, I really don't think I would have been able to do it without you.

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

      great to hear. mission accomplished. May we get a testiomonial from you? You can message Ben at www.linkedin.com/in/bephrem and we can go from there. If not all is well, congratulations.

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

      @@BackToBackSWE I sent an invite from my LinkedIn with a msg. Not sure how you want to do the testimonial pending your response.

  • @doublaitmaxim7540
    @doublaitmaxim7540 3 года назад +6

    I have a test tomorrow on binary trees and this video really helped me out so thank you so much! !!

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

    I found your channel smack in the middle of my data structures and algorithms class. We just started covering this. Excellent!

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

    I've never waited eagerly for the next video of any of the youtube channels literally except yours. Every syllable of your explanation makes sense and is very clear. I wanted to request video for few leetcode problems, try to include these in your line-up. Dungeon Game, Path Sum III, Frog Jump. Thanks in advance!

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

      thanks! but we likely wont be able to do those. We have a lot of organizational things going on that have us busy

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

    I actually like you being on the frame. Helps to focus more and real lecture feeling

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

    Thank you, I never understood AVL trees from my university courses. Your explinations made it crystal clear for me.

  • @yoyocontact5181
    @yoyocontact5181 4 года назад +17

    I lost my job due to the covid-19, now learning and prepping for Tech interviews. Life is tough these days. Also, please please upload more videos on Linkedlists . ( all if possible - from start to end )

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

      message us we can work something out - backtobackswe.com/contact

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

      @@BackToBackSWE Done. Please check.

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

    absolutely loved the way you explain the concept here thanks a lot this really helps me

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

    It's definitely the best course that I've ever seen about AVL tree.

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

    Benyam, you are PRO man! I am fan of your teaching style! Your videos have helped me a lot in my prep. Now I have come back for yet another interview, going though your videos first for a quick learning.
    May this channel be in everyone's recommendation! RUclips you better be listening! XD

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

    This Is the crystal clear explaination of AVL trees I have seen on the Internet....!! You are awsome!!

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

      sure yo

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

      @@BackToBackSWE stackoverflow.com/questions/63649722/satisfying-properties-of-nodes-after-rotation-in-avl-trees I have this question after watching your video It would be really helpfull if you can answer it or any one reading this could answer.

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

    Clear yet thorough. Thank you man!

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

    I'm just commenting to help your videos rank. :) Great stuff and I appreciate all the time you have invested in this channel.

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

      haha tru and yeah jeez its been a year, almost 2

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

    Hey man, don't comment alot but I just wanna thank you for being a big part in me getting an internship. The work you do is invaluable, and I for one really appreciate it. Keep grinding these out, you got a life long sub in me

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

      Congratulations Where did you get the internship at

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

      Yeah eger to know @Eish

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

      Congrats mate! Keep hustling

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

    yo welcome back!!! thanks for helping us. ;)

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

    Hey buddy, you are amazing. Surprisingly I could end up with a solution to a Salesforce coding interview. All with the method of thinking and approach that you convey.. I dont think I would ever get the crux with any other site. Thanks a lot . Please keep posting videos , would love to hear you

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

    This is the simplest vid I’ve seen on this, thanks!

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

    THANK YOU SO MUCH FOR THIS VIDEO!! Very well explained and clear :) Helped me a lot!!!

  • @raywei1701
    @raywei1701 7 месяцев назад

    OMG SO CLEAR sooooo clear guys watch it , this is the best video for understanding the AVL tree~!

    • @BackToBackSWE
      @BackToBackSWE  6 месяцев назад

      Happy Holidays 🎉 No, you are the best Raywei! We'd love to offer you a 40% Off our exclusive lifetime membership just use the code CHEER40 - backtobackswe.com/checkout?plan=lifetime-legacy&discount_code=CHEER40

  • @mayurkoli4145
    @mayurkoli4145 4 года назад +15

    Hey hey!!! My friend is back,
    Welcome ✌️✌️☺️☺️

  • @0x1h0b
    @0x1h0b 4 года назад +1

    thank god !!.. finally you are back.. good to see you buddy

  • @benzeltser9851
    @benzeltser9851 4 года назад +8

    NEVER STOP UPLOADING

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

    Your explanation was very clear, thank you very much you helped me a lot

  • @MoscleBrog
    @MoscleBrog 6 месяцев назад

    my god i understood his explaination and i feel fun doing this work it kinda feel like rubiks cube. this channel is a magic of understanding

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

    Thank you. You explained it much better than my professor

  • @ishaansrivastav5732
    @ishaansrivastav5732 3 года назад +5

    Its hard to find a teacher who explains better than you SWE. Also, +1 on the tries tutorials would love that

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

    Your tutorials save me every time!

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

      Thank You, Glad you liked it.
      Do check out backtobackswe.com/platform/content
      and please recommend us to your family and friends :)

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

    Most awaited video, thanks Benyam ❤❤

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

    Thanks
    I used to hate avl trees a lot because of rotations. But this video fixed it

  • @mritunjaypathak251
    @mritunjaypathak251 3 года назад +13

    Dude Where are you these days, no video for 8 months........you ok buddy?

  • @Delinester
    @Delinester 7 месяцев назад

    This author explained AVL trees better than our professor in 2 lectures. Thank you!

    • @BackToBackSWE
      @BackToBackSWE  6 месяцев назад

      Happy Holidays 🎉 Thank you for your kind words, Delinester! We'd love to offer you a 40% Off our exclusive lifetime membership just use the code CHEER40 - backtobackswe.com/checkout?plan=lifetime-legacy&discount_code=CHEER40

    • @OktayDerman
      @OktayDerman 6 месяцев назад

      professors are like not-teaching teachers at schools stay away from them, go after assistants.

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

    After spending 12 hours non-stop trying to fix just one bug in my AVL tree (with parent node pointers) I've decided to take a step back and watch this video, and this is so much help! I am going to try again now after eating

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

    This video really helped me to understand AVL tree! thanksssss :)

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

    awesome video, my professor should watch these before lecturing lmao. Thank you!

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

    Thanks a lot man, my professor's explanation was needlessly complicated so this helped a lot.

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

      Hi 👋

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

      Haha! why don't you explore our free mini course - backtobackswe.com/

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

    Hey bro , I have loved your teaching methodology , I have started visualising the algorithms , I love you man thank you so much.
    Could you try to cover up segment trees if possible

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

    Yayy ! Welcome BACK Ben !

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

    Thank you so much for the best explanation I ever had.

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

      Amaze! do try our free mini course - backtobackswe.com/

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

    Hi I just can say thank you so much.your video was a great help to me:)

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

      Glad to hear that :) Check out the free mini course on the website - backtobackswe.com/

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

    best dude ever.
    Thank you man

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

    Great video! You're a great teacher. Keep it up!

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

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

    short and precise thank you

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

    love your video! so clear! thanks.

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

    oh wonderful explanation, tysm !!

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

    This is amazing. thank you so so much, now i know how to do rotations

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

    Absolutely stellar explanation

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

    Thanks for the great explanation

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

    Thank you, great explanation!

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

      Glad it helped. We'd love for you to check out our Free 5 Day DSA Interview Prep Mini-Course - backtobackswe.com/ 🎉

  • @user-ok4fx3kl6f
    @user-ok4fx3kl6f 10 месяцев назад

    Thank you for this amazing video!

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

    thanks a lot this video helped me understand avl trees!

    • @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 :)

  • @chrispy808
    @chrispy808 Месяц назад

    Best explanation of this thank you!

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

    Very nice! Thank you!

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

    Great explanation. Very clear, thanks.

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

      thanks, glad it helped! There are other codes at - backtobackswe.com/ check it out. Would love some feedback

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

    Look who's back :) Great as usual Ben

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

    finally a natural explanation

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

    Thank you thos videos are extremely helpful ! Keep going you're the best

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

      haha! thanks. Give a shot to the free mini course on the website - backtobackswe.com/

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

    Very clear thanks!

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

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

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

    I have a really important interview tomorrow. If I remember I’ll come here and update.

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

      Hey, how was your interview?

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

    Welcome Back Brother ...Love from INDIA

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

    Thanks, you explained it better than my prof! xD

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

    my professor literally puts me to sleep, thank you so much for this video

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

      Haha! explore our full DSA based courses with promo code ‘RUclips40’ with a 40% discount - backtobackswe.com/pricing

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

    Hey! I’m also a UMD student, great video! I was wondering what camera do you use to record and what mic do you use?
    Thank you

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

      hey.
      Camera: www.amazon.com/Canon-Mirrorless-Camera-EF-M15-45mm-Video/dp/B079Y45KTJ
      Mic + Mount: www.amazon.com/gp/product/B07K1XSDZP/ref=ppx_yo_dt_b_asin_title_o04_s00
      iPad: www.amazon.com/gp/product/B07XL7G4H6/ref=ppx_yo_dt_b_asin_title_o02_s00
      Pencil: www.amazon.com/gp/product/B082V9VFFZ/ref=ppx_yo_dt_b_asin_title_o02_s01

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

    Very clear bro, thank you

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

      Thank You!!
      Do check out backtobackswe.com/platform/content
      and please recommend us to your family and friends :)

  • @engineering-ux
    @engineering-ux 4 года назад +1

    Awesome as always. Ben is Back :)

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

    Thank you, it definitely helped alot but still i cant figure how do i determine if i need a left or a right left rotation? Like on what do i have to look to know which to use?

  • @kevinw6237
    @kevinw6237 8 месяцев назад

    thank you very much sir. very nice explanation indeed. is there a subsequent video that demonstrate code examples?

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

    this is the best explanation

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

    This is a great video!

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

    Wow what a sleek explanation

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

    he's back!

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

      hey. I never left, just been working on backtobackswe.com.

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

    Thank you very much bro

  • @WrongNicholas
    @WrongNicholas 7 месяцев назад

    helping me through data structures

    • @BackToBackSWE
      @BackToBackSWE  6 месяцев назад

      Happy Holidays 🎉 Thank you for your kind words, Wrongnicholas! We'd love to offer you a 40% Off our exclusive lifetime membership just use the code CHEER40 - backtobackswe.com/checkout?plan=lifetime-legacy&discount_code=CHEER40

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

    i exited out my prof zoom lecture to watch this. thank u

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

      haha! try our free mini course to explore more cool stuff - backtobackswe.com/

  • @user-wo1dy2sg1u
    @user-wo1dy2sg1u Год назад

    Great video. Quick question though: Typically to calculate balance factor should we not do height of right - height of left. This way if its a left heavy tree you can tell because the balance factor will be < -1 and a right heavy tree will have a balance factor > 1?

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

    Great work!

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

    Yay
    Back to back is back

  • @dibaonguyentat600
    @dibaonguyentat600 16 дней назад

    Love this video

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

    so clear! Thank you!!!

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

      Thanks! Do explore the free mini course on our website - backtobackswe.com/

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

    Thx a lot!

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

    Welcome back, Ben!

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

      hey.

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

      @@BackToBackSWE Yo Ben, is the discussion section on BTB SWE still active? I've posted some questions on this video.

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

    Very helpful!

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

    Thanks bro....this is a great content. It will be useful if we have an example where we have say 5 or greater number of nodes and left or right right heavy with left->right or right->left rotation explained. Again, many thanks for this content. You just rock.. Another suggestion is whether we could explain some practical applications of each DS/Alg as and when you cover them in each video. Like now I know what is AVL tree's properties-> Self balancing. Now where is this Self balancing mandatory in some real world problems. Yes we could google this out or get from intuition. But it will be good conclusion to any video you present, once you have this explained. Again, just a thought. Not an absolute requirement. Thanks Bro. Have a good one!

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

    Which app on iPad r u using for demonstration? Seems handy

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

    Your videos are awesome...Please launch a competitive programming course..💁

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

    amazing video!!!

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

      Thank you, means a lot 🎉 You can also check out our free DSA course - backtobackswe.com/