AVL Trees Tutorial | Self Balancing Binary Search Trees

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

КОМЕНТАРІ • 409

  • @KunalKushwaha
    @KunalKushwaha  4 місяці тому +3

    DSA + interview preparation playlist: ua-cam.com/play/PL9gnSGHSqcnr_DxHsP7AW9ftq0AtAyYqJ.html

  • @kookiechan556
    @kookiechan556 Рік тому +182

    Please complete this java/dsa series not only me but many of my friends are waiting for this to complete and get placed in 2024. The best JAVA/DSA series ever. Great Job Man.

    • @krishnaprasadswain7010
      @krishnaprasadswain7010 Рік тому +8

      Yes bro..if you complete this course as soon as possible covering all topics....then you can be free from those comments for DSA

    • @insidiousop3487
      @insidiousop3487 Рік тому +3

      Hey bro can you help me ? I wanna know if i should do those assignments of follow a dsa sheet of other youruber

    • @kookiechan556
      @kookiechan556 Рік тому +2

      @@insidiousop3487 yeah, you should do those assignments those are worth it. Specially the leet code assignments provided by kunal those apply every topic's concepts.

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

      @@kookiechan556 are those assignments enough ? Do i need to do any extra than that ?

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

      ​@@insidiousop3487you would need to do extra for clearing OAs imo.

  • @SaumyaShukla118
    @SaumyaShukla118 10 місяців тому +23

    In the last question, the height of an AVL tree with n nodes is approximately log base2 (n) so the height should be around 10 not 3.

    • @_codewithyash
      @_codewithyash 5 місяців тому +1

      he made an mistake i guess in leftRotate and rightRotate when calculating the height of p and c.

    • @DNthegamer
      @DNthegamer 5 місяців тому +3

      Yes he made a mistake in calculating the heights after rotating it. the height I am getting is 9. Is it correct?

    • @Pawansaini-e2s
      @Pawansaini-e2s 5 місяців тому +12

      node.height = Math.max(height(node.left), height(node.right))+1;
      and
      private Node leftRotation(Node c){
      Node p = c.right;
      Node t = p.left;
      //rotate
      p.left = c;
      c.right = t;
      //update the heights
      c.height = Math.max(height(c.left),height(c.right))+1;//first update c than p bez c comes to below now
      p.height = Math.max(height(p.left), height(p.right))+1;
      return p;
      }
      private Node rightRotation(Node p){
      Node c = p.left;
      Node t = c.right;
      //rotate
      c.right = p;
      p.left = t;
      //update the heights
      p.height = Math.max(height(p.left), height(p.right))+1;//first update p than c bez p comes to below now
      c.height = Math.max(height(c.left),height(c.right))+1;
      return c;
      }
      check the sequence of the height of the p and c in left and right rotation

    • @goutam.02
      @goutam.02 5 місяців тому

      @@Pawansaini-e2s Yeah you are correct thanks for solution

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

    Finally I got a one who makes things easy..😄

  • @RheaMochi-y1r
    @RheaMochi-y1r 8 днів тому

    After so many videos of not being able to understand AVL tree, i land up here and im stunned by how simple this was to understand. Thanks for your time and effort on this!

  • @samosapoint
    @samosapoint 10 місяців тому +4

    You are a master in DSA. After watching your videos only got motivated to attend FAANG interviews.

  • @KunalKushwaha
    @KunalKushwaha  Рік тому +33

    👉 Resources
    - Join Replit: join.replit.com/kunal-kushwaha
    - AVL code: replit.com/@KunalsReplit/Trees-2-AVL

    • @Study_time-gs7xm
      @Study_time-gs7xm Рік тому +1

      please complete the dsa series, we are having to shift to other sources for it, but i want to complete it from you only... u are really good in explaining and detailed and simplified as well. thank u!

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

      Thank You for the amazing session @KunalKushwaha . One Observation. Examples of the 4 cases can cause confusion as to how that state of the tree came into existence. For Instance, @ 30:56, assuming that order of insertion of g-node's children is t2, t3. Then, right-left case would get executed as soon as t2 gets added as a child to g-node, and at this point, t3 is not even added to g-node.
      Please correct me if I am wrong in the concept.

  • @anjalitiwari5843
    @anjalitiwari5843 Рік тому +41

    Only today I have started doing this course n was little worried because it wasn't complete but what a coincidence that you continued posting today itself . Thank you so much kunal sir for teaching in such an awesome way. You are such an amazing teacher n a fabulous person to look up to. ❤

    • @shishiranjanthakur6495
      @shishiranjanthakur6495 Рік тому +3

      What else do you need from this bootcamp bro. Just advance data structure is remaining. But the content which is provided till now is enough for you to crack some tough coding problems.
      What you need more is just practicing more and more questions.

    • @notjod4948
      @notjod4948 Рік тому +2

      It would be complete soon you better start today!! 😅

    • @user-pj1wv1ns9x
      @user-pj1wv1ns9x Рік тому +2

      Sir it wud take so long there r 20 videos 1 video in a month or 4 or who nowsk

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

      @@shishiranjanthakur6495 Kunal promised greedy and DP, so we need that too

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

      ​@@shishiranjanthakur6495every good company asks dp questions which this course doesn't have rn

  • @shivashisharora
    @shivashisharora Рік тому +15

    Thanks Kunal for being so committed to completing this playlist, I can only imagine how you'd be managing your full-time job alongside UA-cam and all the other things you do. Thanks again and god bless you. Additionally, if you ever come to Cambridge and have some free time - would love to meet you!

    • @Hamim-Talukdar
      @Hamim-Talukdar Рік тому

      Hey, the height of the tree shouldn't be 10 because log(1000) == 10, right? So, the output has to be 10. What do you think?

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

      @@Hamim-Talukdar log(1000) = 3, check again.

  • @tanaypatel8412
    @tanaypatel8412 Рік тому +49

    Please Complete this playlist ASAP, learnt recursion from you man it is amazing.

    • @Hamim-Talukdar
      @Hamim-Talukdar Рік тому +2

      Hey, the height of the tree shouldn't be 10 because log(1000) == 10, right? So, the output has to be 10. What do you think?

    • @Soumrnjn
      @Soumrnjn 10 місяців тому

      @@Hamim-Talukdar you are correct bro

    • @Soumrnjn
      @Soumrnjn 10 місяців тому

      @@Hamim-Talukdar i think something wrong in his code

    • @Soumrnjn
      @Soumrnjn 10 місяців тому

      package Tree;
      public class AVL {
      private class Node{
      private int value;
      private Node left;
      private Node right;
      private int height;
      public Node(int value){
      this.value = value;
      }
      }
      public int height(){
      return height(root);
      }
      private Node root;
      public void insert(int value){
      root = insert(value, root);
      }
      private int height(Node node){
      if (node == null){
      return -1;
      }
      return node.height;
      }
      private Node insert(int value, Node node){
      if (node == null){
      node = new Node(value);
      return node;
      }
      if (value < node.value){
      node.left = insert(value, node.left);
      }
      if (value > node.value){
      node.right = insert(value, node.right);
      }
      node.height = Math.max(height(node.left), height(node.right)) + 1;
      return rotate(node);
      }
      private Node rotate(Node node){
      if (height(node.left) - height(node.right) > 1){
      if (height(node.left.left) - height(node.left.right) > 0){
      return rightRotate(node);
      }
      if (height(node.left.left) - height(node.left.right) < 0){
      node.left = leftRotate(node.left);
      return rightRotate(node);
      }
      }
      if (height(node.left) - height(node.right) < -1){
      if (height(node.right.left) - height(node.right.right) > 0){
      node.right = rightRotate(node.right);
      return leftRotate(node);
      }
      if (height(node.right.left) - height(node.right.right) < 0){
      return leftRotate(node);
      }
      }
      return node;
      }
      private Node rightRotate(Node p){
      Node c = p.left;
      Node t = c.right;
      c.right = p;
      p.left = t;
      p.height = Math.max(height(p.left), height(p.right)) + 1;
      c.height = Math.max(height(c.left), height(c.right)) + 1;
      return c;
      }
      private Node leftRotate(Node p){
      Node c = p.right;
      Node t = c.left;
      c.left = p;
      p.right = t;
      p.height = Math.max(height(p.left), height(p.right)) + 1;
      c.height = Math.max(height(c.left), height(c.right)) + 1;
      return c;
      }
      public boolean isBalanced(){
      return isBalanced(root);
      }
      private boolean isBalanced(Node node){
      if (node == null){
      return true;
      }
      return Math.abs(height(node.left) - height(node.right))

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

      check the value of log 1000 with base 10. @@Hamim-Talukdar

  • @funkyboy4882
    @funkyboy4882 10 місяців тому +2

    Kunal, at 1:02:49 you calculated height of p before height of c, which is not correct, because after leftrotate p is above c, and now you are using c to calculate height of p ( because c is at left of p now) but height of c has not changed yet, so height of c should be changed first then height of p.

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

      Thanks bro, i was wondering how i got the height of the AVL = 15, whereas in the theorem, it should be log2(n) which is 9 (if we have 1000 elements)

  • @shubhamagarwal1434
    @shubhamagarwal1434 Рік тому +3

    # GOD Of DSA
    Hi I am a 11yr exp java guy was searching for some free course on youtube for DSA came accross your course and i just feel love in it...all in one place that too with java...i must say you have done very awsome work...your name will be there on this earth as long as DSA will be asked in interviews...May God Vishnu Bless You :)

    • @Hamim-Talukdar
      @Hamim-Talukdar Рік тому

      Hey, the height of the tree shouldn't be 10 because log(1000) == 10, right? So, the output has to be 10. What do you think?

    • @mansinigam1
      @mansinigam1 29 днів тому

      @@Hamim-Talukdarlog base is 2 not 10

  • @nivetha8953
    @nivetha8953 7 місяців тому +2

    the best tutor ever in you tube.thanks for ur service.may god bless you with whatever u want , need

  • @puspendra9330
    @puspendra9330 Рік тому +2

    I didn't know what AVL was, but thanks to your incredible video, I now have a clear understanding of it. loved it!

  • @yashdhanlobhe2985
    @yashdhanlobhe2985 Рік тому +3

    Seriously, when i was doing cp i tried a lot to learn this but i was not able to do it. I left cp and DSA one year ago and this video poped up so i thought let's give a try. And concepts are super clear i am wondering what was hard in this.😮 😮

  • @notjod4948
    @notjod4948 Рік тому +4

    Was Manifesting Yesterday Here we go!! Thanks Kunal for giving us your important time and content 😌!!

  • @RidoyChandraDey
    @RidoyChandraDey 10 місяців тому

    I don't know what happen when I watched Kunals tutorial. It's look like very simple to understand. Thanks again.

  • @Amitsharma-y5r6c
    @Amitsharma-y5r6c 17 годин тому

    "Thank you for helping me fall in love with DSA! It no longer feels intimidating, and I truly enjoy exploring it now."

  • @aajkagyan837
    @aajkagyan837 2 місяці тому +1

    If you are struggling to understand any topic watch it again and again draw it on paper debug the code ,,,, and at last you will learnt it . THANKS KUNAL 😇

  • @shubhambansal8794
    @shubhambansal8794 9 місяців тому +1

    It's getting more cooler day by day

  • @hariharanas9702
    @hariharanas9702 Рік тому +4

    Thank you for posting this. I hope you find time and complete this playlist soon. Once again, thank you so much. Lots of love, Kunal ❤

  • @harshit_ai
    @harshit_ai Рік тому +5

    Finally worthy content that deserves our attention

  • @NeerajSingh-mc5kf
    @NeerajSingh-mc5kf 7 місяців тому

    Earlier I was thinking to buy paid course, but u saved me, u r right no where in world i can get such DSA content, and beautiful explanation keep up good work Kunal. I am always left astounded at the level of dedication and hard work you put in every situation. May you reach every height of success!

  • @rohansunwar9784
    @rohansunwar9784 Рік тому +6

    Such a great course but please can you deliver it in a consistent manner, you are a great teacher man, much appreciated for this course

  • @laxmanprabhu9776
    @laxmanprabhu9776 Рік тому +2

    1st time I saw this video in recommendations, I cross checked for the upload timings 3 times🤣. Thank you kunal.

  • @hackedyou116
    @hackedyou116 4 дні тому

    didnt find any other avl tree videos useful except this. thanks kunal

  • @karthikeyanatuva3742
    @karthikeyanatuva3742 Рік тому +2

    Please Compete the DP and graph series completely ASAP. Your DSA Course is very useful and perfect of all DSA courses on youtube. Please do the course with more standard problems in the respective topic.

  • @abdooman1556
    @abdooman1556 10 місяців тому +4

    I've searched the internet, and yet haven't found a better video explaining AVL

    • @SohelDarwajkar
      @SohelDarwajkar 9 місяців тому +1

      Maybe U don't know Abdul Bari.

  • @thor1626
    @thor1626 Рік тому +22

    Hi Kunal, firstly i want to say that I cannot thank you enough for this series.
    Secondly I have some questions:
    1: Do you yourself revise these concepts before making videos, and is that one of the reason why these videos take so much time.
    2: How many and what videos have you planned to upload next?

    • @Hamim-Talukdar
      @Hamim-Talukdar Рік тому +1

      Hey, the height of the tree shouldn't be 10 because log(1000) == 10, right? So, the output has to be 10. What do you think?

    • @pratheeeeeesh4839
      @pratheeeeeesh4839 Рік тому +1

      @@Hamim-Talukdar😂

    • @Hamim-Talukdar
      @Hamim-Talukdar Рік тому

      @@pratheeeeeesh4839 why you are laughing man. I already have figure out the answer. There was a single code mistake in the Kunal vi AVL tree implementation, that's why it was giving wrong answer. Actually the answer will be 9. If you fell I'm wrong then google it.

  • @ayushyadav1894
    @ayushyadav1894 Рік тому +4

    Thank you so much Kunal updating this series ❤

  • @Rajyadav-yh3rz
    @Rajyadav-yh3rz 4 місяці тому

    After following all the lectures .This was an easy one. Not a single doubt. Thanks kunal.

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

    Kunal Kushwaha is new Superhero. Continue like this. Can not wait for your Dynamic Programming and P-NP lectures.

  • @UCANBRUH
    @UCANBRUH Рік тому +3

    FINALLY my man my motivator the legend is back 🎉🎉🎉🎉

  • @RiyaSingh-ke7dq
    @RiyaSingh-ke7dq 5 місяців тому

    thankyou so much the examples and your way of breaking down the creation of avial tree by adding more elements was really so simplified and i was finally able to understand with the concept of pgc everywhere it was too confusing and the number of examples that you took cleared all my doubts

  • @gowtham9153
    @gowtham9153 Рік тому +4

    59:54
    A small mistake. You have incremented the height of the right node. +1 should be outside the max function. Math.max(.....)+1;

  • @dhruv8871
    @dhruv8871 Рік тому +2

    Nice Kunal ....please dont stop now....Give us complete DSA n algorithms.

  • @ihsannuruliman4005
    @ihsannuruliman4005 Рік тому +2

    Kunal, I thank you for this video but at the same time I'm a little bit discouraged. I've been confused about the height of 3 resulted from the AVL for 30 minutes only to know it's incorrect. But this is not the first time you've done it, you've also made small errors in Linked List and Quick Sort. Maybe consider using more test cases and validate your algorithms using valid parameters before publishing it to the viewer.

  • @arnabchatterjee8556
    @arnabchatterjee8556 Рік тому +2

    Thanks Kunal
    I literally completed the trees vid one day ago ..

  • @karthikeyan.s2565
    @karthikeyan.s2565 Рік тому +3

    Thanks for the next video in the series brother
    Keep posting these videos and complete DSA asap please ❤

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

    Take a bow to this wonderful and intelligent guy.

  • @fftamilan2155
    @fftamilan2155 2 місяці тому

    THANKS Man
    I did get lot more knowledge than a paid course
    Already
    I read a comment that the person said that he won't share this on socialmedia it's because
    It will create a mess for his placement
    Coz
    You know already this is the best course
    So Same here i won't also share this on social media until i get placed
    If i placed i will definitely recoomend it all the students
    I know
    But continue this series
    like dynammic programming
    Coz It will come in handy for the interview/Placement

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

    You are teaching stuffs which colleges struggles and fails to teach. Kudos

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

    Great job Kunal.Learning DSA has become so easy watching your dsa bootcamp playlist!!! Waiting for the DP series :)

  • @AakashKumar-th6rw
    @AakashKumar-th6rw Рік тому +2

    Arraylist ✔
    String builder✔
    Sorting✔
    Recursion✔
    OOPS✔
    Linked LIst✔
    Stack✔
    Tree(in Progress)

  • @devdutdivine
    @devdutdivine Рік тому +5

    Hey Kunal you are giving great quality content which we may not get even in paid one thank very much for this
    I have request pls complete this bootcamp ASAP as after 2 month placement process will start and I am following your course....pls pls🙏🙏🙏

    • @Hamim-Talukdar
      @Hamim-Talukdar Рік тому

      Hey, the height of the tree shouldn't be 10 because log(1000) == 10, right? So, the output has to be 10. What do you think?

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

      @@Hamim-Talukdar log(1000) == 3 check the log formula

    • @Hamim-Talukdar
      @Hamim-Talukdar Рік тому

      @@devdutdivineHere the base of the log is 2. So log(1000) of base 2 is == 10

  • @howsthephysics5822
    @howsthephysics5822 Рік тому +3

    Best video on UA-cam for AVL the way you generalized 4 cases with parent child and grandchildren node was very helpful.

    • @KunalKushwaha
      @KunalKushwaha  Рік тому +3

      You’re welcome

    • @Hamim-Talukdar
      @Hamim-Talukdar Рік тому +1

      Hey, the height of the tree shouldn't be 10 because log(1000) == 10, right? So, the output has to be 10. What do you think?

    • @ashishkushwaha6539
      @ashishkushwaha6539 2 місяці тому

      @@Hamim-Talukdar log2(1000) = 9.96 hence the height will be 9

  • @aayushsharma1106
    @aayushsharma1106 11 місяців тому

    Thank you kunal for these amazing videos.

  • @bhaveshanandpara8474
    @bhaveshanandpara8474 Рік тому +12

    I had a doubt please correct me if I am wrong. AVL is self balancing *BINARY TREE* so if there are 1000 nodes shouldn't height should be [ Log 1000 base 2 = 9 ] than [ Log 1000 base 10 = 3 ]

    • @KunalKushwaha
      @KunalKushwaha  Рік тому +20

      yes, I did +1 inside bracket by mistake

    • @user-nw6jx7eb8f
      @user-nw6jx7eb8f 7 місяців тому +1

      I too got the same doubt

    • @mohamedsaiidouertani3568
      @mohamedsaiidouertani3568 7 місяців тому +11

      @@KunalKushwaha thank you for all your effort you are great, but we made another misatke in leftrotate() function we should update the height of c before the height of p to get the correct height
      c.height = Math.max(height(c.left), height(c.right) )+1;
      p.height = Math.max(height(p.left), height(p.right) )+1;
      return p;

    • @harshrajushire429
      @harshrajushire429 6 місяців тому

      @@mohamedsaiidouertani3568 can you tell me reason why i should update c first then p

    • @AyushGupta-uq6lp
      @AyushGupta-uq6lp 6 місяців тому +2

      @@mohamedsaiidouertani3568 thanks .. that was the major error .. beacuse of this algo was giving the avl tree as unbalanced.

  • @bangtangirl1632
    @bangtangirl1632 5 місяців тому

    Kunal 😢 you are such an angel . Thank you so much

  • @BROOKnim
    @BROOKnim Рік тому +1

    DAMN man, its was super easy understanding this concept.
    one doubt/mistake. ( i believe you made this mistake in leftRotate )
    when calculating height of the node 'p' (new parent) in left rotate , since 'c' (old parent) is going to beon left child of 'p' (new parent), we have to first modify the height of old parent 'c' before modifying the new parent 'p' .
    well this was due to the variable names where noramlly parent shouldve been 'p' but we take 'c' to make it similar to the diagram
    again, thanks for this amazing tutorial

  • @anirudhbhat1442
    @anirudhbhat1442 10 місяців тому +1

    at 1:04:03 i think it is height = log2(no.of nodes) not log(no.of nodes) so we should get 6.something

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

    Amazing video as always. thank you kunal please complete this playlist.

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

    Please complete this java/dsa series I am are waiting for this to complete and get placed in 2024. One of The best JAVA/DSA series ever. Great Job Man

    • @Hamim-Talukdar
      @Hamim-Talukdar Рік тому +1

      Hey, the height of the tree shouldn't be 10 because log(1000) == 10, right? So, the output has to be 10. What do you think?

  • @cadc-pn1ir
    @cadc-pn1ir 8 місяців тому

    There is a small bug in 1:02:11 . The +1 should be outside of Math.max() function.
    Great Explanation Sir. Enjoyed aLot. Thank you so much for this lovely content

  • @namankumarsrivastava4566
    @namankumarsrivastava4566 5 місяців тому

    that such a perfect playlist pls complete it soon brother!!

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

    Kunal can do anything easily.. Kunal for president ❤

  • @AmitPatel-n8i
    @AmitPatel-n8i Рік тому

    Thank you kunal for such an amazing content, your DSA course is very easy and simple to understand even hard topics, your explanation is great.

  • @yashpandey7041
    @yashpandey7041 Рік тому +1

    Cant wait for your DP series!!!

  • @harshit_ai
    @harshit_ai Рік тому +2

    I'm super happy, Thank you for this

  • @ashis.di.sardar
    @ashis.di.sardar Рік тому

    You teach like a PRO!

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

    Excellent teaching!! Genuinely intelligent!! Thank you so much, Kunal

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

    finalllyyy here we goo for the next video

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

    Great explanation, and procedure of problem solving.

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

    love you bro for continuing the dsa series
    Thanks a lot

  • @rajadommeti8744
    @rajadommeti8744 Рік тому +1

    hoping you post the videos faster than usual kunal.....your explanation is really awesome yaar.........

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

    DSA exam on Monday. You're the only help. Best ever java DSA playlist.
    THANKYOU MAN !!✨

    • @Hamim-Talukdar
      @Hamim-Talukdar Рік тому

      Hey, the height of the tree shouldn't be 10. So, the output has to be 10. What do you think?

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

      ​@@Hamim-Talukdarbro if you get the answer please help me

  • @abdooman1556
    @abdooman1556 10 місяців тому +1

    in the height calculator, u added the 1 the the node.right, rather than adding it to the result of the Math.max.

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

    finally kunal is back with bang, please continue this series bro

  • @NoushadPatel-d8p
    @NoushadPatel-d8p 8 місяців тому

    Thanks man for sharing such great video on AVL, As you said balancing trees is just a piece of cake at the end of the video is so true after watching this AVL video of yours.
    .

  • @minthat7677
    @minthat7677 Рік тому +1

    I Just love the way you teach 😊Thank you so much for posting these videos

    • @Hamim-Talukdar
      @Hamim-Talukdar Рік тому

      Hey, the height of the tree shouldn't be 10 because log(1000) == 10, right? So, the output has to be 10. What do you think?

  • @Raha2003_
    @Raha2003_ Рік тому +1

    I was waiting for it.
    I hope u upload next soon

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

    Thanks Kunal for such a great Explanation.

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

    Thank you ❤ Bhiya, god of DSA thanks gain

  • @MeghanaJanupala
    @MeghanaJanupala 25 днів тому

    very useful and resourceful. thanks for all the effort.

  • @BuntyChatriwala
    @BuntyChatriwala Рік тому +3

    Bharata kunal great content but i think you did the height update in the left and right rotate is wrong can you cross check it. i think the +1 will be outside of math max function
    love your content

  • @HarshithMuthangi
    @HarshithMuthangi 5 місяців тому +1

    Great Explanation 👍👍

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

    Great video kunal bhaiya

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

    Life is good when Kunal posts java videos

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

    Thank you sooo much, please continue it sir!, I appreciate it greatly

  • @JerickMamuric
    @JerickMamuric Рік тому +1

    Thanks a lot for sharing this Sir! despite your busy schedule :)

  • @richarai828
    @richarai828 Рік тому +2

    Thankyou so much! I really needed it.

  • @Ken-rj5xi
    @Ken-rj5xi 10 місяців тому +2

    Hey kunal!! Correct me if i'm wrong, at 59:38 the way you calculated height is wrong. Isn't it supposed to be "Math.max(height (p.left)-height(p
    Right))+1;" instead of "Math.max(height (p.left)-height(p
    Right)+1);"

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

    Kunal you should pin the doubt comments after answering them so that we can find them easily ( lecture was awesome similar to linked list ) ❤

  • @ganeshborse5340
    @ganeshborse5340 10 місяців тому +1

    at 1:03:53 the height of AVL tree for 1000 elements must be approx 10, why it comes out to be 3

    • @Aditya.Rawat45
      @Aditya.Rawat45 9 місяців тому

      Hey,i have the same doubt,the height is always 3 for both 1000 and 10 elements

  • @deepakt4737
    @deepakt4737 Рік тому +1

    thanks ❤ for your lectures .. was waiting for this last one month

  • @VishalKumar-je1gq
    @VishalKumar-je1gq Рік тому

    Very in-depth explanation nice , thank you. For high quality stuff 🙂

  • @jsathish8043
    @jsathish8043 10 місяців тому +1

    the above program
    p.height = Math.max(height(p.left), height(p.right) +1);
    c.height = Math.max(height(c.left), height(c.right) +1);
    in this condition height will be 3
    but
    p.height = Math.max(height(p.left), height(p.right))+1;
    c.height = Math.max(height(c.left), height(c.right))+1;
    in this condition height will be 12
    the above two conditions which one is true.

    • @YesAbhi-03
      @YesAbhi-03 10 місяців тому

      Hey brother when brotha ,when did he show the real world example ? 19:50 ??

  • @abhijeetkumar8821
    @abhijeetkumar8821 Рік тому +2

    At 1:04:01 Kunal you got height equals to 3 for tree having 1000 nodes which is not correct. It will be floor of log(base 2)1000. Please correct this.

    • @shadowmonarch1432
      @shadowmonarch1432 Рік тому +1

      Finally found the comment I'm looking for,
      Floor of log(1000) base 2 will be 9
      And I got 9
      As Kunal got 3 I was scratching my head for half an hour
      Thank you bruh❤🥲

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

      Yeah I added 1 inside bracket but you get the idea

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

      @@KunalKushwaha yes and thanks for this amazing dsa course

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

    As usual, you rocked it kunal.

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

    I hope you are doing well Kunal, GOD bless you 🙏
    Thank you so much for sharing your knowledge and precious time. You’re the best 👏👏👏

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

    Your channel and pepcoding are the best

  • @a-classzone1998
    @a-classzone1998 Рік тому

    Thats a relief....
    I thought he will never post again.

  • @swakal8868
    @swakal8868 Рік тому +2

    How is that in 1:03:00 we are getting 3 as the answer. log2(1000) is near about 10. So height must be >10 ?

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

    Awesome As Always and Thank You for giving your time

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

    Hey Kunal, So nice of you to post this incredible content. Requesting you to please teach GRAPH and DP also.

    • @Hamim-Talukdar
      @Hamim-Talukdar Рік тому

      Hey, the height of the tree shouldn't be 10 because log(1000) == 10, right? So, the output has to be 10. What do you think?

  • @TheShopiify
    @TheShopiify 3 місяці тому

    At 39:20, i am really confused rotate right from 16 but kunal you said height diff. Of left and right sub-tress but here is no subtree. So how can we rotate from here. Looking for height from sub-tress or not. Big confusion.

  • @ShiviThagele-lv4si
    @ShiviThagele-lv4si Рік тому

    thanks for continuing the course

  • @thanirmalai
    @thanirmalai 5 місяців тому

    Truly Amazing

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

    Thank You so much! Amazing Explanation as always #DSAwithKunal

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

    kunal back in form 🔥🔥