What is AVL tree ? 4 Basic Rotations(Left, Right, Left-Right, Right-Left) for Balancing with Diagram

Поделиться
HTML-код
  • Опубликовано: 10 июл 2024
  • AVL tree is a self-balancing Binary Search Tree (BST) where the difference between heights of left and right subtrees cannot be more than one for all nodes. This difference is called the Balance Factor.
    In order to perform this balancing, we perform ROTATIONs on the unbalanced/imbalanced Binary Search Tree to make it a AVL tree.
    We peform 4 basic rotations depending of 4 difference cases -
    1) Left Rotation
    2) Right Rotation
    3) Left Right Rotation
    4) Right Left Rotation
    ---------------------------------------------------------------------------------------------
    Theory & Code article - simplesnippets.tech/what-is-a...
    Full Playlist - Full DSA playlist - • Introduction to Data S...
    Full C++ Programming for Beginners Course - • Introduction to Comput...
    ---------------------------------------------------------------------------------------------
    Support Simple Snippets by Donations -
    Google Pay UPI ID - tanmaysakpal11@okicici
    PayPal - paypal.me/tanmaysakpal11
    ---------------------------------------------------------------------------------------------
    Timecodes -
    00:00 Introduction
    00:56 What is an AVL Tree
    08:56 AVL Tree Rotations
    11:02 Left Rotation
    16:02 Right Rotation
    18:03 Left Right Rotation
    23:53 Right Left Rotation
    26:36 When rotation is not needed
    27:33 Why AVL is better
    ---------------------------------------------------------------------------------------------
    Simple Snippets Official Website -
    simplesnippets.tech/
    Simple Snippets on Facebook -
    / simplesnippets
    Simple Snippets on Instagram -
    / simplesnippets
    Simple Snippets on Twitter -
    / simplesnippet
    Simple Snippets Google Plus Page -
    plus.google.com/+SimpleSnippets
    Simple Snippets email ID -
    simplesnippetsinfo@gmail.com
    For More Technology News, Latest Updates and Blog articles visit our Official Website - simplesnippets.tech/
    #avltree #binarytree #datastructures #binarysearchtree #bst

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

  • @6112arjun
    @6112arjun 2 года назад +32

    I like how you tell us to keep distractions aside and not check our phones in between like an elder brother. Thank you

  • @nouhafougi1877
    @nouhafougi1877 7 месяцев назад +3

    you are the best in ALL RUclips you are out there saving lives, i will be forever grateful for you

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

    The best video on BST rotations I’ve seen. Thank you

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

    was waiting for this topic from past 20 days

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

    keep doing, great job. Only because of you I am able to understand AVL tree

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

    This channel deserve Million subscribers....

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

    The best explanation I've watched! Thank you

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

    excellent video dear friend of mine. indians are always the best explaining these sort of computer science stuff, and this one is the best video ive found of AVL rotations

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

    one of the best explanations. thank you!

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

    Very nice explanation 👌.Addicted to your voice and explanation.Thank you so much.

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

      So nice of you. Thank you for the positive feedback. 😇

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

    Such a great explanation!! Thank you

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

    Thankyou for the series!

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

    I really the way you teaching, such a detailed illustration:)

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

    You have great concern about viewers..

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

    Love you for your extraordinary content and lovely explanation

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

    Dude you are the man, thanks !

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

    Thank you sir .One thing, I desperately need the BFS and DFS graph video. Please!!

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

    Waiting for this man... Plzz upload more avl videos

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

    just one word for you-> "AMAZING"

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

    thank you dude, better than my own proffesor

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

    Congrats! Very good explanation

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

    Well explained thankyou !

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

    Thanks bro for finally starting this topic 👍👍👍

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

      Welcome 😊

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

      @@SimpleSnippets when will the next part of AVL tree will come , please bring before my exam Dec 22th.

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

    Best explanatioin hope you start a lecture on DP please

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

    bro this was an amazing explanation

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

    Very good, thank you. :)

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

    fully
    explined

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

    ultimate explanation bro. Keep doing ... keep going ....................

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

    Helpful

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

    Thanks

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

    best video on youtube.

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

    Thanku ❤️❤️❤️💐💐

  • @arbabnadeem427
    @arbabnadeem427 3 года назад +9

    Hii brother,
    best explanation ever of avl tree.
    I want to ask you which tool you are using to prepare these lectures. Tell me the name of it. I wanna also use it

    • @1mol831
      @1mol831 Год назад

      LR rotation can be replaced using RL based which whichever number is imbalanced, 1 right rotation about n1, n1, becomes right child of n3 and n3 remains right child of n2. Then a left rotation about n2 and then n2 becomes left child of n1 and n1 becomes right child of n3.

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

    you r the best...masum

  • @AKASHKUMAR-li7li
    @AKASHKUMAR-li7li 2 года назад

    Height of a node in a binary tree is the no. of edges from the node to the leaf node .

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

    Huge fan sir✌

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

      It would mean a lot if you could please share our channel and videos with your friends too ✌

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

    Just loved your channel 😍 take love from Bangladesh ❤️
    Brother when we will get graph vedio?

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

      Thank you so much bro 😊 graphs will take some time as there's a lot to cover in trees first. Once that's done I'll take graphs too

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

      @@SimpleSnippets ok brother i will be waiting for that & your are doing such a great work❤️keep it up😁

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

    Bhai Thank U So Much. Bhai, also can u upload code for rotation (ASAP), because many viewers of yours (including me) are in semester system, so we are waiting for your more videos. so, it will be very comfortable for us.

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

    thanks for sharing! do you have sample code?

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

    Bro please make a video on trie data structure as well I am having really a hard to time to understand it. btw love your videos

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

      Yes I've already made videos on tree DS 😊

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

      @@SimpleSnippets Yes I know you have made that video and I have seen them all but what I meant was "trie" Data Structure like the "retrieval" the one that is used in the application of finding a word in a dictionary. Thanks for consideration!

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

    25:01 arrows direction is not correct for right rotation is it?. Great tutorial BTW.

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

    Can you also make an video on N-ray trees?

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

    Can you please share the tools used to mark and highlight while you are explaining the video.
    applications and devices used to draw effectively

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

    sir your video is so help full for me thank
    but request you cover DP, Graph, Greedy ,Hash Divide and conquer Please

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

    can we say that for a particular set of nodes AVL tree is unique?
    also nice explanation thank you...I understood it clearly..now trying to make an AVL tree for more number of Nodes :)

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

      Yes, you can, and my next topic will be making AVL tree from more no of nodes in BST!

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

    bro plss also make videos on heaps, m way trees , b trees , red black trees , graphs ...plss bro ....love your videos

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

    When this course will be completed?

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

    Bro plz upload the tries data structure video also

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

    bro if you don't mind ......would you please post as a reply what all the topics that you are going to cover from now.

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

      In this playlist, the first video has the list of probable topics. But I think its going to be much more than that. DSA is a very huge subject so there is no end limit as of now.
      Trees, Graphs, Hashing some traversal algos are left but this is already a lot.

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

    You have a big mistake. you forgot to put the negative sign for the numbers. In 1 it's -30, in 2 it's -10, in 3 it's -30, in 4 it's -10

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

      i think the - in front of the numbers, is just to differentiate between text and numbers, like "insertion - 10, 20, 30", and the number you need to insert is 10, 20, and 30. you can skip the -.

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

    Time waste