 So now we want to focus in on working off of an insertion. So if I came in, let me pick a darker color for that. If I came in and wanted to do something like an insert six. So we'd follow the same rules as a binary search insertion, or a binary tree insertion as always. However, we obviously have to kind of decide a color. So when we're dealing with insertions, insert n as a red node. OK, well, that makes things pretty easy, if you will. We know that we'd make our transition from 50 to 15, and then to five, and then I'd come in and add my six. Now, does that going to always work? Not necessarily. And in fact, we are in a situation where it's OK. You see, if my parent is black, OK. And we keep on moving on because I've not violated really any rules. The same premise is going on that each one of these leaf notes has some number of null black children. Our black depth is still fine. We have not, in essence, done anything. We haven't broken any rules by doing that insertion. However, you can already see that that's going to be a kind of question then. Because what happens if my parent happens to be red? And so let's actually kind of take that same example. What if I were to come in and I were to do, in this case, and insert 21? So just as I mentioned in my previous example, we insert in as a red node. So in this case, this would have to get removed, that little child node would be taken out, and it would become a red node 21. The problem is if we're following the rules of a red black tree, the red node must always have black children. And right now, I have a red node with a red child. So we are put into a new kind of conundrum. So if my parent is red, I have a few cases that I can work off of. And so what I actually want to look at is what we would classify as my parent's sibling. So I'm going to add a few different letters out here. So I have, say, a parent, a parent sibling, and then my in. So I want to look at my s. If, well, we'll just say, if s is red, then what we want to do is we want to do a few what we would call recoloring. So what would we do? Well, we would change p and s to black. Then change what we would call my grandparent. That's all the way up here. And I'll just call them g for right now. We change the grandparent to red. So we would go ahead and do that. You see that I come in, and I'm going to need to make a few changes here. So once again, this node is going to become black. This is probably the only really kind of quick and easy way to do this, I think. If you happen to know a faster way of changing this into a black node, be sure to make a comment below. I can't believe I actually just said that. But like I said, I color out my parent and my sibling, my parent's sibling, done. And then I would come in and I would color my grandparent red and I'm done. Or you might say, well, no, you see, just because you made that black that works there and that red node has all black children, but we're not done yet. And so actually what's going on here is the final step in this process, in this sort of 1, 2, 3 process, is we move in to grandparent and repeat if necessary. So you see that we've just done this recoloring of my parent, my parent's sibling, and my grandparent. So again, I would take my in, take my in, and move it all the way up here. Now when I say move, I don't mean move 21. What I say, what I mean is let's come in and let's get rid of that G. And let's classify this as my new in, this is my new parent, and this is my new sibling. Reason being is because if I scrap them out, I make that same assessment. Well, my parent happens to be red. My parent's sibling happens to be red. And so just like we've seen in the past, I would change my parent and my parent's sibling to black. So yes, I do have to kind of go through this again. I'm going to experiment with maybe that paint bucket. Let's see if that kind of speeds this up. Oh, that did actually quite nice, slightly. And its parent is now red. Now you're probably saying to yourself, but that still violates another rule. Well, guess what? We are not done because what was the last step after we do our color changes? Move in, move in to its grandparents. Now in this situation, you see that in happens to be a root. It's 50. There is no parent to be judging off of. And if we find ourselves in this situation, so if n is root, change to black. So if we're looking at sort of all my different rules, this was one rule. If the parent was black, OK. If this was another rule, this was sort of a sub rule to it, this is another rule entirely. This is actually the first rule. Because if I had an empty tree, I would insert a red node. And well, that would be the root. And so to kind of finalize that, I'd come in. That was the wrong layer, and turn it black. And so now I have a balanced red black tree.