 So we do have a limitation when it comes to the binary search tree. Let's say for example I came in and said something like insert 4. Since I don't have anything on my screen this would become my root node and I would now have a 4 here. What happens if I would then in turn come in and say something like insert 3, insert 2, and then insert 1? Well if I follow that order that means my 3 would be smaller than my 4 so it gets put to its left and since 2 is less than 3 it would get put to its left and then the 1 on its. The reason why this is kind of a problem is we actually are running into sort of a limitation like I said of a binary search tree in that I might have a height of in. However, elements, however many elements I have in the tree that's actually how many levels I have in the tree as well as we can sort of see here at 4 elements and 4 levels. But what if I wanted to implement some way of having a log in number of heights, number of levels inside my tree and so that's actually where we would introduce what we call a 2-3 tree. Now a 2-3 tree is a specific example of what we would classify as an A-B tree. The idea here is that I want to have sort of that log in height the entire time even as I start adding and removing elements from it. So the concept of the 2-3, what that breaks down to and again it can expand if we have more of these but it says now that my tree is going to have either two nodes or three node elements in them. So what does that mean? So a two node gets broken down that it's going to have one key into children. You can already start to see where this might come into play. With my three node I have two keys in a particular element and three children. So let's take a look at that same example that I was just working off of. Insert 4, insert 3, insert 2, insert 1. So I do my insert 4. So I still am going to have my first element but I'm going to actually sort of create this construction where I make the everything a quote-in quote three node. I've got two slots available for my four in this case. Well since this node, this root node has nothing in it it just gets put in there right away. Nothing terribly outlandish goes on there. But like I said what happens when I create another insertion and I did an insert 3. On this case I actually have to make a slight adjustment to my node because 4 is in this case greater than 3 so it would get kind of hopped over to the secondary node. So 3, 3, 4. But this is where things get a little interesting because what happens now when I do an insert of 2? So if in theory we were to try and add it to this, you know my my tree would break, my application would break because I can only fit two keys into any given node. So in this situation I would actually have to do what we classify as a split. And in this regard I need to take my new key, I'm going to call it K1, my old keys K2 and K3. So what do I need to do? I need to determine which one is going to become the new root. The idea is I want to still maintain this idea that even though I've got three elements, I don't want them to kind of, I don't want three levels. So what I do is K1 and K3 are going to get new nodes. Let me say this. So to determine that new node make K1 and K3 new nodes nodes and make K2, how do I phrase this? Make K2 the only key, only key in the I wouldn't even say it's in the Make K2 the parent, there we are, the parent of K1 and K3. So in this regard what we're kind of looking at here is like I said I take my K1 and my K3, the smallest and the largest if you want to think of it like that K1, smallest key, K3, largest key. Those are both going to get their own new separate nodes. So K1 being two gets its own node and K3 four, sorry, node four gets its own node. Both of those are in turn going to have sort of that K2, the middle key be its parent. And so what this allows me to do is sort of maintain a very limited size. As such as you can imagine I still need to come in with that last one, my insert one. And in this regard I see that well in this case I don't want to just immediately put it here, right, because I have leftover spots available sort of in my leaf nodes. So I have to determine first where does this go, where to go. Well one happens to be less than three so it's going to go to the left, just like a traditional binary search tree. And just like we saw earlier when I added three and four, three kind of took over that less, lesser spot in the keys, this would get replaced with a one and this would get its two. So let's say for example I wanted to go and I wanted to create an additional few more inserts, just for you know that sake of getting some practice in. Let's say I came in with an insert and I'll go super big, ten. Alright well that same principle is going to come into play. I still have my root node, I still have my left child being the one in the two and I have my greater child, my right child which right now has a four in it. Notice how it happens to have an available spot in it. So again I did that same question of where do I put this? Well I move it to the right, in this case I would put it at this ten and be perfectly sound. The reason why I wanted to do this is what happens if I finally come in and I do something like an insert seven. So if we kind of redraw everything really quickly, I've got my one and two over here and I've got my four and ten over here. Four, that's a terrible four, four and ten. So the first thing I need to know is where do I put this? Now I don't just magically put it there. Aha I'm done. Ding ding ding. No, no. I have to go down to my root nodes, I have to go, sorry my leaf nodes, I have to go down to the most bottom level and I have to attempt to put it here. So I would attempt to be putting it here. There we go. I want to put it here. The problem is once again I'm only allowed to have two keys in any given node so I can't just magically do this. So instead I have to make a decision. Well which one would be my K1? If we remember correctly I said that the K1 has to be the smallest key in that node. So that would be my four. I have to look for my K3. My K3 is my largest key in that node and then the leftover key in this case our seven would come in and it would be our K2. So what happens? Well I split this up so that four is going to have a node, ten is going to have a node and seven is actually going to go up to the parent. So in this case what we should see happen if I kind of bring it over here and I'll even kind of still leave it a little blank for now I'm still going to have that one and two over on the left but like I said I break it up into two separate nodes. So four is going to get a node, ten is going to get a node and seven is actually going to be moved up to the parent which I'm allowed to do because I have an available slot and if we kind of remember the first rule I have a three node which is allowed to have two keys and three children.