 So one of the things that we can do if I have found myself in a very heavy Balance, I have a negative 2 here on my 25 node. What I can do is something we call a rotation. So the entire premise of a rotation is we're going to take whichever node is the heavier node and we're going to actually swap it with the 25. Now I'm not just going to swap 25 and 15 because that would actually break the laws of a binary search tree. The entire premise is that I'm going to take some node, let's say I'll call it x, and I take some y. We'll call that, you know, y. Now if we were to think about it, x is the child of y. Well, y has what we would call some other subtree. x is the exact same way. It has some potential children, so it has some potential subtrees as well. Now I'm going to call these subtrees t1, t2, and t3. So we just talked about that idea of a rotation. If I look at my x here, I see that I have it on the left side. So what I would want to do is what we would call a right rotation. And what we'll get, if I cover this up for a moment, what I will get in this case is something that looks something like this. Let me get this out of the way for a moment. So again, I take a look at my nodes. x is going to become the parent and y is now going to become the child. But what about t1, t2, and t3, these subtrees that we've been dealing with? So if we kind of look at that, t1, if we imagine t1 having some value, some node, some anything in there, you notice it's a left child of x, which means whatever I have in t1, I know by putting it in there, it was less than x. If that's the case, we're actually going to give that tree to x as the left child. Now what about y? Well, if we take a look at, say, that t3 for our sake, we can tell that everything after, everything in the right child of y, we know is greater than y. So the same kind of thing is actually going to happen. We're going to give it t3, that, sorry, needs to be t1. Reason why is t2. t2 seems to be a little bit of a hang-up. Where does it go? Well, one, if we think about a binary search tree, I can't give it to x because x already has two children. My only options are either I give it to another tree or I give it to y. But y, y. So if we think about it, everything to the right, we know is going to be greater. And what I mean is, everything in t2, if it was inserted, we know has to be greater than x. Well, if we look, x is less than y. And if we follow that same principle that anything to the left is less than whatever our node was, we can see that we have some limiting factors to it. It has to be, at least, whatever we put here, whatever we put at t2, has to be greater than x. It has to be greater than x, but less than y. Let's take a look over here. If I go to the right, that means I'm greater than x. And if I go to the left, that means I'm less than y. So let's take what we've just seen here and let's apply it to our binary search tree. Let me turn it back on. So we see I have a 25, 15, 5, 40, and 20. Well, if we take that same premise, that 15 is my x, 25 is my y, we could think of 40 as that t3. We could think of 5, I should use a different color here. We could think of, let's see, blue. We could think of 40 as t3. We could think of 20 as t2. And we can think of 5 as t1. If 15 was x and 25 was y, that rotation that we were just talking about, I'll get rid of this for the sake of seeing it. As you can see, what we will do is we'll make 15 the parent, 25 the child. So 15 the parent, 25 the child, 40 is going to be given to y and 5 will be given to x and then that 20 will be given to y. So since I've kind of made a little bit of a mess, let's actually kind of take that approach and let's apply it. So we see once again, 15 is going to be the new parent, y is going to be the new child, 15, 25, and we break it down from there. So as we mentioned, 15 becomes the new parent, 25 becomes the new child. This is, let me make it so that it's at least in the same size here. So 15, 25, 40. And what were those other ones? Oh, 5 and 20. So 20 and 5. Now we're not technically done here. I know that that was a lot of work, but we have to reassess all of our balance factors. We've just changed every one of these nodes. Did we actually make it balanced? If not, well, guess what? We have to rotate again. So these are still zero. This is a 1, this is a 0, this is a 2, and this is a 3. So if we then checked our nodes, our balance factors here, we see that 15 has a balance factor of 1 minus 0, which equals 1, and 25 also has a balance factor of 0 minus 0 or 0. And so what we've just done is balanced our tree.