Amazing explanation! I wish my university professors could teach like you. Life would’ve been so much easier. Thank you so much for making these videos, it’s really helping me in my algorithms course.
if you write this code exactly, your balance function might not work. to fix that, add an update function in the insert function for the node as soon as you create it before returning. This is very important as the height and bf of the subsequent subtrees depend on the leaf nodes
Looking at the comments, I think I am just dumb for not understanding it. I don't understand the part after the rotation. When rotation is done, and we have new root at the top, how do we connect to the parent? how does it happen, don't skip that part please. because parent still has reference to the rotated node.
Lifeng W I'm pretty sure the reason is that the immediate left node before rotation might have a right child. When the rotation happens that node appears on the other side resulting in a +1.
We're talking about the same node. However, a node is considered 'balanced' if its balance factor is -1, 0 or +1. The only time we have to rebalance a node is when the BF is either +2 or -2. This is why after the rotation the balance factor of the root is allowed to be 0 or +1 in a left -left a rotation.
Your data structure videos are the best resources I've ever encountered. Thank you for awesome tutorials!
+1. Clean concise code. Clear concise explanations. Thank you!
This is by far the best explanation for AVL Trees pseudocode, I could find on the internet! Really awesome content.
Your explanation is top-notch, I'm not even kidding.
this is the best DS tutorials hands down!
Amazing explanation! I wish my university professors could teach like you. Life would’ve been so much easier. Thank you so much for making these videos, it’s really helping me in my algorithms course.
Thank you very much! You did amazing job!
I watched others video and didn't understand AVL tree, but yours did the trick :)
if you write this code exactly, your balance function might not work. to fix that, add an update function in the insert function for the node as soon as you create it before returning. This is very important as the height and bf of the subsequent subtrees depend on the leaf nodes
Best explanation for AVL tree on youtube!.
At 7:32, why is the condition to test if a rotation is "leftleft" or "leftright" node.left.bf
The best explanations I have ever searched, thanks a lot ^_^
Your tree rotation video is awesome and easy to understand too, very helpful for me!
You are much better than my professor.. Thanks!
Genius! Simplicity and effectiveness themselves! liked and subbed
Čeps lik je na ego tripu sadaaa
7:11 wrong code...please edit video....
The connecting lines of the trees need to be thicker. They are almost invisible.
Amazing explanation. The breakdown of what's happening makes it look so simple. Thanks :)
@WilliamFiset Man you are a amazing. hero! Superman!
5:23 "pseudo-code" == almost python
Python is pseudo code
Is the code examples in C+?
Man you're being awesome! Thanks for that... Keep that up! :)
Looking at the comments, I think I am just dumb for not understanding it. I don't understand the part after the rotation. When rotation is done, and we have new root at the top, how do we connect to the parent? how does it happen, don't skip that part please. because parent still has reference to the rotated node.
Very good explanations! Keep'em coming :)
After rotating, the balanced factor of the root node is 0(+1) for the left-left case. Why including +1? Thanks
Lifeng W I'm pretty sure the reason is that the immediate left node before rotation might have a right child. When the rotation happens that node appears on the other side resulting in a +1.
The immediate left node(4) before rotation has right child(C), but C is already in the balanced tree whose bf is 0. Right?
We're talking about the same node. However, a node is considered 'balanced' if its balance factor is -1, 0 or +1. The only time we have to rebalance a node is when the BF is either +2 or -2. This is why after the rotation the balance factor of the root is allowed to be 0 or +1 in a left -left a rotation.
These are amazing thank you!
dayuym, this some crazy shi , thanks
You r awesome 😎
the most unseful youtube video on youtube dislike because the tree is on balans already