 Now we only went through a few of our cases. We actually were missing one more and to kind of illustrate this what if I changed this node to 24. Let's just arbitrarily say that I came in for 24 for the purpose that I want to make a new insert of 21. Well in this case you'd see that we do kind of follow the same principle. I jump down between my trees, I see 24, and so I would make my 21. Just like we've kind of established before, 24 has another black node and 21 also has these null nodes as well. But sort of the ruling is, I mentioned in the last video was if parent is red, that's our first criteria. But then we want to look at that parent's sibling. So just to kind of draw these numbers out, I have some in, that's me, I have some parent and then I have some sibling. So I really kind of hammered in that these have some null black nodes and the reason why is because the sibling to my parent right now is a black null node. So if sibling, and well I'll say I'll call it s to explicitly talk about the parent's sibling, not my sibling, but if parent's sibling is black, in this situation we can't just do a simple recoloring. I can't just magically recolor p because well s is already kind of being taken care of. So instead we find that we do our good old-fashioned trinode restructuring. And so we have to kind of handle all the practices that came into trinode restructuring. First that in is kind of being created. My parent is going to be created and you might remember that we have to have my grandparent. We were calling it z in previous videos but to just kind of not have to throw too many additional letters on the screen. We'll just kind of keep them as in p and g for this. And just like a trinode restructuring we find out which one is going to be my a, which one is going to be my b, which one is going to be my c. And we still follow the same principles of trinode restructuring in that I'm only caring about these three variables. Again myself, my parent, my grandparent, my x, my y, my z. And as always we work off of the idea of in-order traversing. So in our case we're looking to see what happens first. Well since we're not dealing with any of g's left children it would happen to be my a because then I would access it. Then I would access the right children of g and we see that I get to p. But p happens to have a left child. So we would access it next and then finally p would come in. So once again as we've seen in the past as we've seen plenty of times b is going to become the new parent and a and c are going to become the new children. Any sub trees that exist are going to get inherited to either a or c. So in this case you happen to notice that we have null nodes so we're actually kind of in a lucky spot here. So the first thing we do is we do that restructuring. So I'm simply going to kind of draw this uh slightly off the screen uh slightly not off the screen but slightly away from this this kind of connection because that's a very beautiful looking tree and I don't want to ruin it just yet. So you see that I would get 24 here you see that I was sorry not 24 21 here you see that I would get 24 here and you'd see that I get 20 here and then you'd probably say well hey you know that didn't actually sort of resolve anything this still happens to be you know red. So now that we've done this restructuring I've repositioned everything the reason why I kind of wanted to draw it over here is what we do is we take a and we're going to make it red we're going to take c and we're going to make it red and as you can probably guess we're going to take b and we're going to make it black. So in this case 21 well that's just kind of over the top of that circle we turn that one into a black node and then we turn 20 into a red node try and get it right on top of that line and we turn 21 or 24 into a red node it happens to already be red so we are already kind of in place and so what we would see as sort of a kind of modified look to this is I'd come in I'm going to get rid of all of that stuff I was just dealing with so here and I would just take this kind of structure that I I just built and I would kind of apply it here so once again 21 is a black node just to kind of reconnect that then I happen to have two children of which I'll kind of use coloring I have 20 which is a red node and I have 21 24 which is also a red node and if we kind of look at the same rules as always our root is black our red nodes all have black children here and here and here and here and here and here and here and here and here and here and here and here and here and if we recalculate black depth once again that's kind of important so if say for example I was to go to say 15 we see that I see I've got one two three black nodes here one two three here one two three here one two three here one two three here one two three three three three three and so as I've just kind of mentioned black depth has been maintained so just to kind of write this back out once I've done that trinode restructuring I change b to black change a and c to red