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

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

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

  • @yonathanmichael1910
    @yonathanmichael1910 3 ปีที่แล้ว +214

    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 ปีที่แล้ว +45

      haha hey

    • @WyMustIGo
      @WyMustIGo 3 ปีที่แล้ว +14

      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 ปีที่แล้ว +306

    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 ปีที่แล้ว +47

      great - flourish in life friend

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

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

  • @dramallama111
    @dramallama111 2 หลายเดือนก่อน +5

    As always, why is that some guy on youtube can explain these concepts so much better, and in a shorter amount of time than most college professors? It boggles the mind.

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

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

  • @arjunkashyap8896
    @arjunkashyap8896 4 ปีที่แล้ว +21

    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

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

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

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

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

  • @weallgotwoodandnails
    @weallgotwoodandnails 4 ปีที่แล้ว +14

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

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

  • @benzeltser9851
    @benzeltser9851 4 ปีที่แล้ว +8

    NEVER STOP UPLOADING

  • @Delinester
    @Delinester 10 หลายเดือนก่อน

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

    • @BackToBackSWE
      @BackToBackSWE  9 หลายเดือนก่อน

      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 8 หลายเดือนก่อน

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

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

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

  • @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/ 🎉

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

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

  • @hawadoh
    @hawadoh 7 หลายเดือนก่อน

    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

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

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

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

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

  • @mritunjaypathak251
    @mritunjaypathak251 3 ปีที่แล้ว +13

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

  • @raywei1701
    @raywei1701 9 หลายเดือนก่อน

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

    • @BackToBackSWE
      @BackToBackSWE  9 หลายเดือนก่อน

      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

  • @MoscleBrog
    @MoscleBrog 9 หลายเดือนก่อน

    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

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

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

    Thank you. You explained it much better than my professor

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

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

  • @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 ‘TH-cam40’ with a 40% discount - backtobackswe.com/pricing

  • @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! TH-cam you better be listening! XD

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

    Welcome Back Brother ...Love from INDIA

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

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

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

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

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

    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/

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

    This tutorial is awesome, since there is no dislike button, I just let you know in advance !

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

    finally a natural explanation

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

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

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

    Best explanation of this thank you!

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

    The legend is back with a new video

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

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

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

    Lost me when counting nodes became positive and negative @6:10 ...is it negative when you go right, and positive if left?

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

      Hi, is this referring to balance at a node?

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

      Back To Back SWE
      Yes 😂 that is very confusing for me. All the positive 1 and negative 1 values

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

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

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

    Absolutely stellar explanation

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

  • @WrongNicholas
    @WrongNicholas 9 หลายเดือนก่อน

    helping me through data structures

    • @BackToBackSWE
      @BackToBackSWE  9 หลายเดือนก่อน

      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

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

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

    Wow what a sleek explanation

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

    right in 6:09 I decided to just pause and get to code to see if I can understand it. I ended up with something not very stable but it works XD
    Done in Python, I'm not sure if this may be O(n log n), it prolly depends on how bad the tree that is traversing is
    class Node(object):
    def __init__(self, data=None):
    self.data: object = data
    self.left: Node = None
    self.right: Node = None
    def get_height(b: Node):
    def inner(b: Node):
    if b is None:
    return -1
    return max(inner(b.left), inner(b.right)) + 1
    return abs(inner(b.left) - inner(b.right))

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

      still figuring out how to implement the rotation btw, ended in either a stack overflow or loosing a bunch of nodes along the way

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

  • @monjasonsteng7861
    @monjasonsteng7861 22 วันที่ผ่านมา

    Thank you - this was great!

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

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

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

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

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

    Im literally having my data structures exam in 10 hours and this video is saving my ass

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

      Hope it went amazingg 🎉 Please enjoy a special coupon from us - backtobackswe.com/checkout?plan=lifetime-legacy&discount_code=SUB 🚀

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

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

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

    short and precise thank you

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

    he's back!

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

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

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

    holly crap your explanation is spot on! thanks a lot

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

  • @youareunderarrest.3173
    @youareunderarrest.3173 4 ปีที่แล้ว +3

    I kind of miss him shouting near that white board.
    Welcome back. ✌️

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

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

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

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

  • @GeovaniLopesDias
    @GeovaniLopesDias 5 หลายเดือนก่อน

    In english, LR and RL rotations are so intuitive! In Portuguese, I'm struggling to get what the heck a "double left" rotation looks like...

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

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

    Very clear explanation! Is the tree at 8:30 actually a BST though? Because 0 is to the right of 2...

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

    best dude ever.
    Thank you man

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

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

    Amazing explanation, yet a code breakdown would really come in handy (btw, still no C++ solution at the site)

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

  • @user-zm3uw5ij9r
    @user-zm3uw5ij9r 4 ปีที่แล้ว +1

    please do a video on explaining the red black tree.....and comparision of red black tree and avl tree

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

    love your video! so clear! thanks.

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

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

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

    Yay
    Back to back is back

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

    Around 11:25, when the purple tree has to be greater than y right? Since y < x and purple >= x.

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

    Yayy ! Welcome BACK Ben !

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

    Look who's back :) Great as usual Ben

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

    oh wonderful explanation, tysm !!

  • @JAIGANESH-gd3qj
    @JAIGANESH-gd3qj 3 ปีที่แล้ว

    please make a video on boolean parenthesization problem

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

    I love you, you are my G.O.A.T.!!!!!!

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

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

    Thx a lot!

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

    You are a legend.

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

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

    Very nice! Thank you!

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

    King's BACK!

  • @kevinw6237
    @kevinw6237 11 หลายเดือนก่อน

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

  • @dibaonguyentat600
    @dibaonguyentat600 3 หลายเดือนก่อน

    Love this video

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

    thanks

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

    12:45 How did we fix the balance if the tree became heavy on the other side

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

    Thank you very much bro

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

    i have an exam about his stuff in like 3 hours. lmao. lets goo procrastination gang

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

    Could you not flatten the tree, get the node with the value closest to the median and set it as the root?

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

    11:20 the purple node can't be equal to y, because the insertion condition was, smaller=left, bigger or equal to=right.

  • @100_swastiksanyal5
    @100_swastiksanyal5 ปีที่แล้ว

    what i understand is we will not get a AVL when a leg is crooked. at first we have to straighten the leg then we should rotate to get a AVL

  • @engineering-ux
    @engineering-ux 4 ปีที่แล้ว +1

    Awesome as always. Ben is Back :)

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

    Sir, I want to join your course
    When will course start or can I join whenever I can?.
    Is there any discount for the course?

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

      It is just a perpetual service. We do not have any open discounts, but we have an email list we send discounts to sometimes.

  • @freakfreakk2386
    @freakfreakk2386 3 หลายเดือนก่อน

    Thank you man

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

    nice nice you are back

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

      I was always here. Just coding and working on our service most of the time. Found a gap to post something.

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

    Great work!

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

    Nice

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

    you should have told general situation in which R-l rotation and L-R rotation are done

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

    I actually tried to solve self-balancing all myself, and surprisingly my idea of balancing the tree was exactly the same as rotation!

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

    I noticed that your second tree isn't a BST so it couldn't be an AVL tree anyway, but that is nitpicky I guess lol.

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

      I think I cite that in the notes? Don't remember but thx