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.