Balanced binary search tree rotations

Поділитися
Вставка
  • Опубліковано 18 гру 2024

КОМЕНТАРІ • 48

  • @qazaqwert
    @qazaqwert 3 роки тому +144

    Why are free videos on the internet better than my college professors. Have a midterm on BST stuff tomorrow, this is a major help.

    • @markbauer542
      @markbauer542 3 роки тому +3

      hello connor6woop

    • @Zucr_
      @Zucr_ 3 роки тому +21

      Because teaching is not the main profession of your professor. Their real job is to do research but they teach on the side. You can expect them to understand the material very well; however, you can't expect them to know how to convey that information very well even though you are probable paying up the ### to take their course.

  • @isunktheship
    @isunktheship 5 років тому +18

    Extremely concise and clear! I was just asked how a self-balancing tree works and.. while I know how binary trees are built and function, I never learned about rotation and balancing.

  • @Art-fn7ns
    @Art-fn7ns 5 років тому +19

    That's by far superior to what my prof forced out of himself. Thanks!

  • @Jason________
    @Jason________ 3 роки тому +2

    This is a top 5 educational video of all time

  • @リンゴ酢-b8g
    @リンゴ酢-b8g 2 роки тому +4

    A balanced binary tree, also referred to as a height-balanced binary tree, is defined as a binary tree in which the height of the left and right subtree of any node differ by no more than 1.

  • @MSneberger
    @MSneberger 4 роки тому

    3:31 defines BST as n.left < n and n > n.right. Now go to example at 4:25. Let's assume A = 4, B = 3, D = 1, and E =2. If when we rotate we make E the left child of A we follow the definition as to A, but we now fail the definition as to B because E < B even though E is in the right subtree of B. That would mean that if we searched the tree for the value 2 we would start at the root B with value 3 and go to the left subtree which would not lead us to E thus we would lose our O(log n). I am struggling to reconcile this.

    • @MSneberger
      @MSneberger 4 роки тому

      I see now that if B = 3 then E has to be >= 3 so it could not = 2.

    • @yutaitadori7318
      @yutaitadori7318 3 роки тому

      Thanks

  • @learn001
    @learn001 2 роки тому

    Considering the alphabetical order and the invariant as n.left < n and n < n.right; the BST shown in the videos does not satisfy the invariant condition.
    In the left tree we have N.left = B, n = A, and n.right = C. Now, B < A < C is not true. in the right tree: D < B < A < C is not true.

    • @idwtv534
      @idwtv534 2 роки тому

      exactly i don't understand this. did you figure out what he is trying to say?

  • @joseville
    @joseville 2 роки тому +3

    7:00 I think the code would be simpler by having methods that handle the double pointer update, i.e. methods `setLeft Child` and `setRightChild` which update the corresponding left/right pointer as well as the parent pointer, if any.

  • @joseville
    @joseville 2 роки тому +4

    Great video!
    3:13 I think it would have been best to label the nodes such that the inorder traversal is
    A, B, C, D, E

  • @yomamasofat413
    @yomamasofat413 9 місяців тому

    3:31 does E have to necessarily be less than A? What if it is more?

  • @kaloyankraynin3944
    @kaloyankraynin3944 4 роки тому +4

    Great video man, exactly what I needed! Helped me a ton :)

  • @pudisasikar7996
    @pudisasikar7996 4 роки тому +5

    Dude... Ur Amazing visuals making damn easy... How come I found this late... I Bookedmarked urs... Awesome explanations..

  • @dudeiknowman
    @dudeiknowman Рік тому

    Thanks for making man! Super helpful.

  • @quachhengtony7651
    @quachhengtony7651 3 роки тому +2

    I have a question: How to insert a new node to an existing balanced binary search tree (not an AVL tree)? Do I insert the new node normally like how I would with a binary search tree and then apply rotations? Or do I insert it into an array first, sort the array and then rebuild the balanced binary search tree?

  • @randyn1080
    @randyn1080 Рік тому

    Absolutely incredible. Thank you very much for your videos!

  • @rashmikulkarni9703
    @rashmikulkarni9703 4 роки тому +1

    To the point and clear explanation :) please note, the AVL tree intro: might not be the correct link. Thanks

  • @deineoma1301
    @deineoma1301 2 роки тому

    Thanks for the great explanations squeaky-voiced teen from Simpsons.
    Your explanations actually help a great deal and are more entertaining than my text books:)

  • @stupit1679
    @stupit1679 3 роки тому

    top 20 university and this video explained something i didnt understand for an hour in lecture in 8 mins

  • @Victor-tl4dk
    @Victor-tl4dk Рік тому +1

    What is a "logarithmic height"?
    What is a "linear height?"
    Would it not be better to say a height based on linear proportions?
    I do not like meaningless language which this seems to be an example of. Pease feel free to explain :-). Maybe I'm not "getting it"

  • @Jalalx
    @Jalalx 5 років тому +6

    Two trees at 3:10 are a bit confusing! It would better if numbers were used instead of letters.

  • @raminshahu9
    @raminshahu9 2 роки тому

    Amazing video man love it

  • @kazakhification
    @kazakhification 5 років тому +1

    Preparing to my amazon interview with your videos. Thanks!

  • @massinamas
    @massinamas 3 роки тому +1

    What is the difference between remove and delete?

  • @jodoinscott
    @jodoinscott 4 роки тому +1

    Thank you for this very helpful video!

  • @irisvioletta
    @irisvioletta 2 роки тому

    great explanation

  • @hasan0770816268
    @hasan0770816268 4 роки тому +1

    a very good explanation, thank you 👏

  • @minezgio3175
    @minezgio3175 5 років тому +1

    Thanks man really helped out.

  • @idwtv534
    @idwtv534 2 роки тому

    Can some one tell me how is D < B? and how is A > C?

  • @sandessharma8195
    @sandessharma8195 4 роки тому +1

    This is pure torture... :P Thanks though.. Got an exam tomorrow and this helped..

  • @1ONEOFONE1
    @1ONEOFONE1 7 місяців тому

    Blanced Binary Search trees are cool

  • @gabrielpereiramendes3463
    @gabrielpereiramendes3463 5 років тому

    Thanks a lot from Brazil!

  • @alvinc5225
    @alvinc5225 4 роки тому

    damn.. that's beautiful!!!!!!!!! Thank you so much!!!

  • @patcoder1287
    @patcoder1287 4 роки тому

    This is AMAZIN !
    Way better than the crap served in MIT Open Courseware

  • @Yetipfote
    @Yetipfote 3 роки тому

    Computer Scientists: "Let me introduce you to the secret high-art of informatics, young Padawan!"
    me: "Haha jQuery go brrrrrrrrt!"

  • @WEARETHEDESCENDANTSOFGIGACHAD
    @WEARETHEDESCENDANTSOFGIGACHAD 4 місяці тому

    My collage professor(he actually didn't deserve to br called a professor) did this topic it took him a whole hour long and in the what we got was lots of confusion

  • @tianchenjiang759
    @tianchenjiang759 4 роки тому +1

    u saved me

  • @bipin_karki
    @bipin_karki 5 років тому +1

    Your website has an error !!! 503 Error .

  • @dariocline
    @dariocline Рік тому

    the goat

  • @hethosdeus3504
    @hethosdeus3504 6 років тому

    The DSW algorithm works well for balancing like this.

  • @Coldsteak
    @Coldsteak 2 роки тому

    I still don't understand lol

  • @gena8414
    @gena8414 4 роки тому +1

    u seem too surprised by elementary things. It's a bit annoying and distracting.
    Anyways, ok video. Helped me learn so thanks.