So, in the yesterday's class, we have started an important tree of DB that is B-tree and B-tree is basically the balance variant of balance M-way tree. We have witnessed that M-way tree was offering the multiple path axis, but it may also face the problem of left skewness or right skewness. So, therefore, to mitigate those problems, B tree was introduced. And there were some properties in the B tree. first it says that the root node the root node can have 2 to m child internal node internal node can have m by 2 to m child so there should not be any violation and third important property other properties are as similar as M-way tree, all the leaf should be at, all the leaf should be at same level. So, these were the some properties that were different from that of M-way tree. So, by ensuring all the leaf at same level or ensuring this internal load root M by 2, sorry, ceiling m by 2 to m this b tree ensures the height in the left and right direction are comparable and in this way the our target of achieving log of n computational complexity for searching insertion will remain intact okay so we have started and seen these properties there is a fourth third property as well so number of key in each internal load is one less than that already we have witnessed in MV3. Now then we have started a discussion on the insertion. So whenever there will be an insertion we will first try to search it. So first we will search. If search is unsuccessful means that the element is not found then what we will do? We will try to accommodate the node where we are right now or where we have declared that the particular element is not available so there might be two condition if that node is empty empty means that there is some space where we can accommodate so add it add it in ascending order okay so whatever the suitable place we will add it if it is full then what we will do then the scenario is add the new element in a specific order now we have added the new element in the specific order then then what we will do then pop up the median element and place it into upper node okay upper node what we will do we will add the node and pop up the median element and when median element will be proper of course we will got two node in place of one node okay and both the nodes will be left and right child of that specific node and the pop-up one one will add into the upper node okay and the pop-up one will be added into the upper node to a specific place. Childs are defined just we have to insert it. So, this was a 5 order tree and we have to add let us say 4 in this. So, 4 will first go to this node, 8 say yes, you can accommodate on my left now it go 4 go here. So, these nodes say there is no further node downwards. So, we can accommodate you on this label. So, 4 will be added at its specific place. Similarly, for 5, 5 will be added because there was a space and this is 5 battery, so 4 key could be accommodated on each node. 4 keys can be accommodated on each node. Now, when we want to insert 58 in this scenario, in this we want to add 58, then what will happen? So, 58 first go to 8, 8 say you can go to, you can be accommodated on my right, but 96 say you can be accommodated on my left then it start exploring the downward path what it identified 37 46 55 86 55 and 88 not 86 88 now 50 it will come here so it will be probably accommodated here but when we accommodate 58 here then what will happen then this node will have the key more than the allowed one. So, what will happen? The median will be what? 55. For median, the formula can be n by 2 plus 1 or n by 2. So, this is for odd and this is for even. Okay. Now, 55 will go up and 2 child that will be 36 and 37 and 46 and 58 and 88 will be formed and it will be added to its appropriate location. So, appropriate location is what? Before, after 8 and before 96. So, after 8 and before 96, a new node was introduced with two child, one is 36 and 46 and another child is 58 and 86 is introduced. Okay. Now, someone says I will do one more level up. Okay. So, what it is? So, we are inserting 6 in this tree. Insert 6 in this three six go to eight eight say there are nodes on my left and you are since you are less than me then you could be accommodated here so it will go to this node so these nodes says two four six you could be placed on in after five you could be placed after five but we are having the maximum node we are having the maximum node so what we will do we will pop up five to the above node so what will happen? 2 child 2, 4 and another child 6, 7 will be formed with a 5 node pop up. But when a 5 arrives here, then what will happen? 5, 8, 55, everything will be added. But this node again will have more than the maximum keys. So, if 5 added here, so 55 will be pop up and when 55 pop up then we will have 2 child 5 and 8 on this side and 96 and 116 on the another side okay and remaining things will be likewise okay so what we can witness from here we are witnessing that rather than what the trees we have covered so far after insertion they were growing downwards, this B tree is growing like an actual tree and it is growing upwards. So, I hope this insertion is clear. If there is a place, simple thing, if we want to insert new node first search it. If not found, then we have to insert. If not found, then we have to insert. And all the two cases if you have, so the insertion is done after searching. okay and deletion in b tree is a little bit tricky so i will start after one more example then just keep your seat for patiently for half an hour i will cover the things then i will take up the queries okay and this insertion i am just finishing so let us consider another tree that is of order 3, that is of order 3. And in this we want to do certain insertion. So, when we are saying order 3, so child, maximum child will be what? 3 and minimum will be 2, because 3 by 2, chilling will be 2 and keys will be 2, 1 less than the number of child is 3 minus one so this we have to keep up now this is a order three three so maximum child could be three now we have to insert 75 so first it go to 50 50 says there are entries on my right you can check it out now it arrived here so 60 says i can accommodate you but there are entries on my right and it seems you are on my right so it will go here not 65 70 and 75 will be there so these nodes declare that we are not there in the tree but if we accommodate you here then i will violate the property because number of key will become three so what will happen so the median element that is and plus one will pop up and go in the above node and we will form two child that we will form a structure like 70 one child is 65 and another child is 25 and this 70 will be accompanying with 60. Now we are inserting 57. So 57, 50 says you could be placed on my right then 60 and 70 say you could be placed on my left so now 57 arrives here then what will happen this will again start violating the order 3 b3 property because the maximum allowed key was 2. Now 55 57 and 58 so which one is median 57 so 57 will pop up and goes here and we will have a node 57 with two child 55 and 58. Now what will happen? Then 57 arrives here, then this node is again full. So the median element that is 60 will go up. So if you see here 50, 60, 57 is now added here and 70 is added here. So that thing is, this will pop up, then median element will pop up. So this is called as the cascade cascading operation we were inserting 57 but it let down the disturbance in the tree at two hierarchical level it it can go even more okay when your tree is let's say very long so it will even go more so i hope insertion is clear so even if anyone has any doubt in insertion let us take then we will start deletion no sir currently there is no hand okay one need this okay it is you can go first hi sir good morning good morning so for insertion of 75 as we insert 75 in the first step we see 65 70 are together and when we try to insert 75 we have to send 70 up due to the rule violation and then we separate 65 and 75 so why did we separate 65 and 75 we could have kept them together right no no so uh when we are inserting a uh new node so 65 70 75 so this is the policy key when a node will be pop up so these two will be splitted at its left child and right side okay okay yes okay got it got it sorry you can go next very good morning sir good morning sir actually i have a question uh it is like the doubt is regarding that conceptual uh thing about the data structure i just want to ask like uh we have binary tree and like b plus b3 right both have like time complexity of order of login so my question is that why do we practically need b3 because in this case we are neither like the complexity is not uh improving in terms of b3 to be sorry from binarity to b3 then what's the need of like b3 okay so actually when we are following uh this multi-label hashing okay so in which we know we are storing the addresses of uh let me open it so basically what will happen when we talk about the multi-level hashing okay so what basically we are doing we have these many number of um information stored okay let's say one two three four till 1024 and let's say this information so what we will do when we try to directly access so what we will do we will start from this location and keep on searching. So order of let us say it is very long. So your response time will be accordingly very large. So what basically we did? We made a index. So that say I will store the value in chunks of 100. So whenever we want to search we go to a specific chunk and it provides the 100 addresses where we have to search. So searching time is reduced. Now we have another label of hashing that say i will store 10 10 addresses of this hash table only so when i request comes so it will just search uh uh in the 10 specific addresses and accordingly it will go outside so what basically we are doing on each label if you witness there are not single node they are not single node they are having multiple entries so if you resemble the bst binary search tree so that we are having a single entity and here we are having multiple entities so this is basically the structure of b tree and in case of binary search tree when we have to access only to two part because because if we keep here one uh let's say one node so we cannot do this so for multi-level uh you can say here are hierarchical arrangement or multi-level access we required this kind of structure so again i'm saying this bst and b trees uh conceptually they are more or less similar but where the place where it will be used for multi-label hierarchical arrangement b trees are used where each node is supposed to have more than one entities as compared to that of binary search stream okay and binary search trees is specifically used for a you can say very smaller operation or you can say we have remember one application the duplicate removal duplicate removal in the ram if we want to remove some some data we have we want to remove something there bst can be used but when we talk about the data databases or very large values there are stored then this type of hierarchical things are from and if you remember the tree this b tree okay it is also looking like a hierarchy and one more additional thing i will tell that b plus tree there is a famous that is you can say variant of b tree that says that all the data will be pointed by the leaf only and internal node will hold the pointer to that data okay so uh that are the things that you you you can again yes so basically yeah that's right like uh you told like if we have multi-level hierarchy then it is like we are using b tree instead of binary tree so basically this multi-level hierarchy is introduced just to make the like sort of search uh like searching of the data and yeah yeah efficient so it's like see uh if we have binary tree or b tree both have like in terms of time complexity if we see both have like order of log n uh the search timing yeah so if we if we like uh use a single b tree or multiple binary search it would also come down to order of log n ultimately the complexity yeah so that is what i am trying to get why we are not using binary tree in the like second there is no role of binary dreams so for example if i make multiple binary tree okay so what i have to i have to store the root node information into the ram okay i make thousand binary binary tree so i have to maintain thousand informations in your ram and here what i will do i will just store a node information of of this multi-level hierarchy a single node information into the ram so that's why it when it grow grow grow grow grow faster now then from this access we can only get the access of entire memory but if you use binary tree then what will have binary search tree so to just two two two two labels we are going down down so multi-level hierarchy could not be possible using bst so both three are existing but their role is different their role of b3 is towards the the secondary storage and bst towards removal of duplicate element efficient searching and other aspects so that we can primarily do in the main memory so both are existing that i am not saying even b3 b3 was introduced bst is vanished so both are still exist so basically i just want to uh i just want to get this clear line uh what makes this difference like why why would transist from b binary 2 to b3 that that was like whole of my point so simple 100 bst or 100 binary search tree can accommodate if i just talk about a single label can accommodate let's say 2000 addresses and a single pst with multi-label hierarchy okay can so let's say in your ram there is only 10 address looking and it can store around 2000 so what means that in place of maintaining 100 trees simultaneously i am maintaining just one tree hitting maintaining multiple bst will be very much difficult so now we have just to maintain and we know that in in array to store the addresses we have to just store the address of the first value okay okay and when we have multiple such small small small array so we have have to store all the information so so the this is the thing there if we are in a very layman term we are cooling a room with a let's say three turn air conditioner and someone say i will apply six point five ten point five ten ac so which one is efficient of course three turn will be efficient because and because we are overusing it okay so so basically so we can think of like though we can implement it it will have some sort of drawback like binary binary tree but the more efficient one would be the b tree yeah yeah in organization wise in putting the things into the memory yeah yeah okay sir thank you sir look not you can go next good morning sir so last solution can you just go to that page that 50 60 was in a root node right it is uh there should be one element or so this is so on basically each level we will have a set of elements so it is if you see maximum key allow was two so 50 60 could be maintained if it was already full then one node will be pop up and a label will increase further then that is not the root node right now right 50 60 there together 50 60 together is a root root is allowed to have 2 to m child minimum child is 2 and maximum child could be sorry 2 to m minus one child so 2 to sorry root is allowed to have one key to two key in this scenario so here there are two keys so it is root if it is one key then also it is root okay okay so getting a point the root node does not mean that always it will have a single value it can have multiple value depending upon the order of the tree so if order is m so m minus one key could be accommodated on the root and minimum allowed is two yes okay okay so i was thinking that that should be only one element no no no one element is the extreme case okay okay you can go next now okay hello sir good morning good morning sir i have a query regarding assignment three so what would be the syllabus for Assignment 3 will be till AVL property, I hope. So, it will not cover inventory even or somewhere it will cover. Sir, everyone is done. Okay, thank you. Thank you, Jeevan. Now, there is another critical thing that we will do that is deletion. So, So, this is a structure I had made, handmade. So, if we are deleting from the leaf node, if we are deleting from the leaf node, leaf node means that there is no further child. So, what could be the scenario? The leaf node contain the more than minimum key, because we have to maintain what? m by 2, 2, m child or key could be m minus 1, okay. So if child is let us say 3, so key could be 2, okay. So if it is having minimum, more than minimum, for example, a 5-bay tree can have minimum, minimum number of key will be how much? 2. Key will be 2 and child will be, minimum child will be 3. So if it is having more than minimum, so we can simply remove it no worries if it is having just minimum and we want to remove one node then what we will do so there is three possibility so we will borrow a node from our left sibling or right sibling okay so if both are having minimum more than minimum no worries if both are having just minimum then we will do a merger and height will be reduced. So one by one I will tell with the example rather than going into the theory because when we visualize then again we will come back and see how this property was utilized. Now this is a tree and this is a very famous example. It will cover all the cases. Now we have 50, 80. The order of tree is what? 5. So maximum allowed key is 4. Internal node can have 3 to 5 chime and key will be obviously 2 to 4 keys. There is a cap over the minimum. And root can have 2 to 5 chime and 1 to 4 keys. This information mandate okay so now we want to delete 64 so go to 50 50 says yes i can accommodate so um because i had no node on my right so you should search so now it go here so 60 says you 64 could be on my right and 70 says 64 could be on my left so they go down now we identified 64 here okay Okay. And what we want? We want to remove 64. So, the minimum allowed keys is what? 2 to 4. And here number of keys are 1, 2, 3. So, I can remove easily 64 and we will see the resultant trees looking like this one. Okay. Because when a node is having more than minimum number of keys and we want to remove a node from the leaf, then what we will do? we will simply remove it. So, 64 we have simply removed. Now, we want to delete 23. This is the critic here. This is the resultant one. Now, in this tree, I want to remove 23. So, 23 first we will search 50 left 20 right and here we found 23. Now, this node, this node is having how much two key and two key is the bare minimum okay and there is no right sibling sibling i hope everyone understand so here there is no right side of this node so there is no right sibling but there is left sibling okay and then it asks its left sibling i am having just bare minimum are you having more than minimum so it says yes i am having three node and as per our rule, we required only 2. So, what will happen? A node from the left sibling will be going to replace 23, but it will be channeled via the root. It will be channeled via the root. So, what will happen? 60 will be removed, 16 will be removed, it will replace 20 and then 20 will come down. So, this is a tricky part. What I say, when I have just bare minimum node, then I will look for the left or right sibling. But in this case, there is only left sibling. Now, it will ask left sibling whether you are having more than minimum node. So, So left sibling say yes I had because minimum required is 3 and I had the minimum required keys is 2 and I had 3. So I will provide one of my key and you can easily remove 23. But we know that there is no direct access in between these two siblings. So it will be passed via the route. So 16 will replace 20 and we know that from the left sibling which node will be picked the highest one. That already we understand. And that will replace this one at 20. And if there was right sibling, for example, we were removing six. And there was only two nodes. So minimum from the right sibling will be picked. So there is an important information. If node is having bare minimum. So, what will happen? First, it will ask highest from left or if exist, it will ask lowest from right. This is clear and it will be rooted through, it will be rooted through, it will root it through, rooted via root. So they will not directly come, they will be rooted via root node. So for here, there is a root node. So 16 is the largest key in this. So it will replace 20 and 20 will be replaced by the 16 and then 20 go down and replace 23. so the resultant tree will be this one there is no node here and 16 gone up and 20 is here now node 23 is there i hope you will understand so if you remember this was the scenario because we are dealing with the node of removal node in the leaf one so the leaf node contain the minimum tree then what we will do brow borrow from immediate left node sibling or borrow from immediate right but there was no right. So, we had borrowed from immediate left. But this could be situation. So, we will see later on where though left and right sibling persist, but they do not have any extra node. So, what we will do in that scenario, we will talk about that. Now, we are targeting to removal of 72 from above node. So, where is 70 to 50? right 80 left then 60 right 70 right 72 left so here we find we find 72 but it have both left sibling and right sibling now if it go left sibling it is having bare minimum i will not provide then it will go to the right right say yes i had more than because i need two and i am having 3. So, it will say because I am right sibling, so you will get the smallest element. I am right sibling. So, you will get the smallest one. So, now what will happen? Now, what will happen? 77 will go up, replace 75 and 75 will come down and replace 72. So, of course, the order will be maintained so 73 will go forward and 75 will be added here so that what what we did 77 is replacing 75 and 75 will come down and take its specific location okay so here what we have witnessed the next case that was borrow from the immediate right so when we are borrowing we will borrow the smallest and here we will borrow the largest okay so i hope this is clear now there is a critical deletion. There will be a critical deletion. We want to delete 65. We want to delete 65. I hope everyone is getting the deletion by taking the help from left sibling or right sibling. Now, there could be third case where we have to remove a node 65. So, let us see where 65 is. So, let us see in this. So, 60, 50 says my right, 80 says my left, 60 says my right. So, here we encountered 65. Now, if you see left sibling is having 2 and right sibling is having what? 2. So, both are having bare minimum. So, what we will do now? So, that is is a tricky part. So, I will say one statement, if both siblings are having bare minimum nodes or sorry keys then then merge merge the node with either left or right that is very important merge node with either left or right and bring down the parent from the root. So, what we will do when both the nodes are having bare minimum. So, we can either choose left sibling or right sibling and what we will do we will do a merger. So, when these two nodes are merged, one node will be bring down. So, 60 was the parent of these two node, we will bring down and remove 65, the resultant tree will be likewise. So, 60 was come down and these two nodes were merged and now this is the resultant tree. So, again I am repeating, I have to delete 65 and what we have identified both on the left part and right part there were bare minimum. So, what we can do? We can merge with left or merge with right and while merging we will bring down one node. While merging we will bring down one node and that node will be the parent of the both node. So, if we merge left sibling, so the parent is 60. If we merge right sibling, then the parent will be 70. So we bring down 60 and while we bring down 60, 65 will be removed and it will be placed on its appropriate place. So if you remember that graph, so merge the node and bring parent down. This is the scenario. If the leaf node is having more than minimum simply remove it if it is having bare minimum look out the left and right sibling if they are having sufficient node so we can bring for left highest and for right lowest channel through the root and the node will be replaced if both the left sibling and right sibling are having bare minimum then we will do a merger and bring the parent down i hope you people get it now let us take let me let me take the queries and then we will talk about other other for internal nodes yes uh yeah given in uh someone are raising hands uh one by one one yes sir good morning am i audible sir yeah yes yes please sir uh so uh as we understand uh if you can just go to the previous slide sir where you were uh uh yes sir so uh this is something like Now, if we see the 16 and 23 example which you've given, so it is something very similar to the LL rotation and RR rotations of the AVL tree to balance out. And in this case, it is because of the rule. Yes, yes, yes. Yeah, yeah, yeah. Yeah, yeah, that is like a rotation. We are doing the rotation to balance the tree. And in this case, we are doing the rotation to maintain that key node values as per the rule of the B2. Yes, yes, yes. Okay. Now, sir, my second question is, you have given an example where the left and the right both have minimum number of keys, correct? Yes, here, here. Then we do the deletion and the parent is brought down to this thing. That parent brought down is important, otherwise parent-child relationship will be violated. Yes, the minimum key violation will be there on the note. Yes, sir. So, my question is that if left and right both have the maximum keys, so which one can we give preference? Anyone? Anyone, anyone. That is your choice. So there is no priority. No, no, no, no, no. But usually, usually in our, you can say, as a person, we prefer left always to come up. But that is not a strict rule. Right, sir. Thank you, sir. Thank you. That was my question. Yes, you can go next now. Hello, sir. Yes, yes. Good morning, sir. Good morning, sir. Most of the example that we have seen so far, uh if you see in in any of the nodes uh we we don't have the duplicates right duplicate is not allowed in b tree ah okay it's a prerequisites yeah that is there i mean b plus three we will see duplicates are allowed but in b tree there is no allowance of duplicate okay okay okay thank you do you want to ask your doubt or is it okay so jessie you can go now yeah thank you uh good morning sir when we were deleting 65 we brought the parent down and we took the merge the remaining also to the left side why can't we do it like um we can bring the 68 to the parent right 68 70 72 and we can bring the 60 down right that will also not violate what you are saying 68 will go up i guess yeah and 60 will come down so that could be one property but but in the literature this specific rule is mentioned that what i am teaching you can make of it your own so what will happen in that case now you have to every time identify the this replacement and other stuff of course 68 when it will go up so there will be only one child of 68 that is 51 and 55 51, 55 and 60 51, 52, 60 and there will be no you can say right child of that 68 68, 70, 77 will combine together 68 comes so there will be no child here there will be no child all will be placed here 51 52 and 60 that is the case yeah yeah so so basically what if if we go ahead when we will talk about b plus 3 so there what we will do it is we will never keep a situation where leaf node of where there is no part to the leaf okay so that is one one reason as well but if you are missing so you can propose one you can come up with one modification that we can do like this one. But in B tree or in B plus tree, there is a must condition that a node should add a leaf kind of node. So, that is the reason we are not targeting that. So, every left and right should have a leaf. Yeah, leaf. So, because if you talk about this arrangement, hierarchical. So, if we miss that, then we are missing certain locations, we are not touching it hitting okay so your your property is valid okay your your policy is valid so it will be true you can say it is a variant of b3 but later on when we talk about the databases then this will fail yes sir i think that will violate one of the cases because we should have minimum number of five by two so if we take 65 like 68 up and march then it would have only two children's in that case so i think that would violate because it would have minimum it will have three three to five uh five 51 50 so she is saying 60 will come down and it will be replaced by uh 68 so we will have 51 52 60. so that is another variant of algorithm also but it would have like two children's only right at that time 70 75 and then it would have like two children one is for 51 52 and 68 and then another one is 73 and 75 no so i will just draw that note okay just to be so what's he's telling 68 70 75 and this will have one address pointer to 73 and 75 there will be no child for this one and then the here will be 51 52 and 60. so of course here we are having four child so that is allowed but sir minimum number but sir minimum number should be five by two right ceiling of five by two three so minimum is three so here we are having four one two three four though there is no pointer but it is it exists okay so like null pointer are also yeah that is also count okay given doubts are done so we will see how we will delete yes yes but yes yeah hi sir yeah hi sir so what does it mean by both sibling has bare minimum key how it's i didn't get that one okay good question so here for 60 if we want to delete 65 so its left sibling is what 51 52 and right sibling is what 73 75 so the minimum allowed key was what 2 because the child was 3 so both the nodes have 2 2 so how we can bring or ask them for a key because they are just running so 51 52 is 1 and 1 is 73 75 sibling means that the cousins so here 65 or you can say 68 so this is also having minimum and this is also having minimum so that is called bare minimum node that is minimum two that was required so that they have getting are still not getting okay thank you okay everyone is completed yeah yeah thank you given. So now we will talk about little bit more complicated cases. Now in the same example, if I want to remove 20, see this. So 50 left, 16 right and here we encountered 20. Now the situation is critical because it does not had any right sibling, just left sibling is there and in this case we cannot ask because this is having two nodes. So what we will do, we will merge and bring down 16 that is obvious case but when we try to bring down 16 so there is again a violation of minimum key at this label okay so what we will do then we will merge with this one and bring down 50 16 will come down so two step will be there two steps will be there So, what we have did, we have bring down 80. So, just I want to remove it. So, if I want to remove 20, so what will happen? So, 16 will bring down and merge the node that we understand easily. But when we try to bring down 16, but when we bring down, want to bring down 16. In that case, what will happen? It is not allowed because it will violate the minimum key or minimum child property. So, what we will do? We will bring down 50, merge. So, 10, 50, 70, 77 will be formed and there will be a new node that is 14, 15, 16 and 27. So, if you see the resultant, so 14, 15, 16, 77, 10, 50, 70, 77 and just we have bring down and root is allowed to have two child that is there okay so this is you can say cascading one if we want to bring down 16 we have to also bring down 50 because it will violate the if we don't bring down then it will violate the b3 property that is the internal node should have minimum ceiling of m by two nodes and maximum m nodes okay and root is allowed to have two child So, I hope this is clear. So, this is bit tricky. So, while deleting 20 understand there are two deletions. We have to first delete 16 and 16 deletion required what? It required bringing back the parent 50 and merging. Then that 16 is stored in the temporary location will go to downwards and 14, 15, 16, 20, 27 will be 20 will be removed and the new node will be formed. Now, in this tree, so I hope all the cases are done when the, we want to remove the node in the leaf, leaf is done. Now we will talk about the internal nodes, deleting node in the internal. So just taking a quick break and we will start, I am, I will, okay, now let us go to the scenario where we want to remove internal nodes okay so in the above tree what we have obtained after two label of merger we want to remove 70 so identify 70 80 left here is the 70 okay and if you remember mway tree so what we were doing we were removing the the node with the in order successor or predecessor or we can say the highest node from the left or the lowest node from the light will replace it. So, here if you see on the right there is no possibility because this is having minimum 1. So, from here we will bring 68 up and that will replace 70 and 70 will be deleted in this. So, this is in order predecessor or we can say that highest element from the highest element from the left ok so this is easy to go now we want to delete 95 in this ok in this node after getting sick i want to delete 95 where is 95 here is 95 here if you see this is having three and this is having two so again 100 will bring come up so this will be in order successor in order successor okay this will replace okay so 100 is coming here so this is also clear so there are two possibilities we can replace it with in order predecessor or we can replace with in order successor okay now one question arises why sir, we cannot directly remove it because they are having associated child pointers. Okay. Now, here the question comes. We want to delete 77. So, 80 is left, 77 is in counter. Now, here we cannot apply in order successor or in order predecessor because both are having the minimum so what we will do we will merge them we will merge them so what we will do we will bring 77 down merge them and remove it so what we are doing bring 77 down merge the two siblings okay just I will write clearly bring node down and merge the two siblings okay so we have merged and bring down okay so you can see I hope the things is clear because 77 does not have a sibling that can have more than minimum key. So what I have done, I have removed 77 and merge both the key simple you can say remove the node merge both the sibling remove the node merge the sibling. Okay, this we have dead. Now I hope this is clear. Now next one removing 80. Removing 80, 80 is where? If you see here 80. Now one says, now well let us remove 80. So while removing 80, what we can do? We can bring in order predecessor or in order successor, whatever required. But here if you see in order, successor is having just bare minimum. In order successor here will be 81, not bare minimum. In order successor will be 81 and in order predecessor will be what in order predecessor will be 79 so you can bring any of them so 79 is coming here okay now if we want to delete 100 so 100 is here and if i remove 100 then there is will be merger of this one but the condition is if i delete 100 then what will happen the minimum node property will be violated so removal of 100 will be required what 79 will bring down a solid node will be formed and then these two node will be merged. So, these are the all cases that we can do in the RB deletion. So, again I am repeating the internal nodes deletion. Just remove all those stuff. So, afterwards what we are doing, we are removing internal node. So, removing internal node, so first we are targeting removal of 70. So if you want to remove 70 here, so we can ask in order predecessor or successor. So there is no node in the successor, extra node. So we will bring 68 up and the things will remain done. Now if we want to remove 95 from this, so 95 is here. So we do not have node in the predecessor. So we will bring successor up and this will be the resultant. Okay. Two cases are clear. Now we want to remove 77. So 77 is having both left sibling and right sibling with minimum. Then what we will do? We will remove it and merge them. We will remove 77 and merge them. Okay. Now we want to remove 80. So 80 can be removed from its predecessor or from its successor. So predecessor of 80 is what? In order predecessor is 79. And in order successor is 81 so either we can remove it with 81 or 80 because these nodes are having more than minimum node if it is not having more than minimum then we will look after here okay now then we want to remove 100 here if we want to remove 100 okay if you want to remove 100 here so 100 is having can be removed but both the siblings are having minimum one but if we remove 100 then what will happen this node will be unstabilized so what we will do 79 will bring down a new node will be formed and this node will be merged okay so I hope all the scenarios are clear then there are other example that we will see but up till this if anyone has doubt let me know then we will see one more example now given anyone is not having any doubt so whether I am teaching very good or you people are everything is going on no no no varoon is there yeah sir can you repeat the 81 once again i missed it once again okay so removal of 80 yes this this one 80 what we will do we want we it will be replaced with in order predecessor or in order successor okay so in order predecessor is what 79 and in order successor is what 81 and 79 is in the node that is having more than minimum 79 has come up you can also come up 81 because it is also having more than minimum so that is the case getting your doubt is done yeah so you brought it from the leaf node why not i have brought it not from leaf node i have brought it in order predecessor in order predecessor is the node that is just less than this one okay okay okay okay there is no entries now yeah everyone done sir okay so what i will do give us sorry one more sir one more please please please he wants you can go now am audible yes yes you are audible sir when we remove the 77 in the previous slide yeah so when we removed the 77 we merge uh the below child properties like 73 75 78 79 yes so when when we delete 77 so uh to which these these figures will point to like this is 68 68 right 68 right will be 73 75 so here you can see now 68 right but it caught it thank you okay so uh what i will do because um we have cover up uh you can say complicated thing so i'm stopping here and the next class uh we'll see one more example then we will start the heap so heap will be the last topic or not arbitrary is there and afterward we will jump into the graph so in the next on the saturday lecture we will try to start the new thing that is graphs. So, I am closing here because it is not better to start a new part here or let me complete these some examples here. One more example I am solving for B tree deletion and then we will proceed. So, now here we want to delete 6. In this node we want to delete 6. So, 6 is here, simply remove it because it is having more than minimum because this tree was 5 order so 6 we can easily remove now we want to delete 27 find 27 27 is here so if 27 is deleted no worries we can easily remove the 27 okay because it is having more than minimum now we want to delete 60 60 is having more than minimum 16 more than minimum so 16 and 66 can be easily removed okay now we want to delete 50. now in this tree we want to delete 50. so what will happen If we want to delete 50, so we will ask with the left sibling, right sibling, no more available. So what we will do? But if we remove 50, then this 68 will bring down. This 68 will bring down and then these two nodes will be merged. So what we can witness, the resultant will be 10, 68 will be here and this one. So this example, I hope is clear. So I am stopping here. New topic, we will start in the next class. okay so thank you Jeevan so though today's lecture was short but yeah I will take the queries two more people are there yeah yeah please so they can ask you can check your term yeah can you hear me yes yes yes my question is that sir in an exam do we need to actually implement all these delete insertion operations or like understanding is enough understanding will be more than enough okay okay thank you sir sir uh actually i have a doubt uh where we did something uh like uh change in the merging procedure uh like uh can you go to the slides uh like uh where we have deleted like 65 or 70 that was one of the key where we have deleted it delete 65. ah sir i think i think one slide above before like this yeah yeah so this was the case where you told that the null pointer is also considered valid so i think for the internal node i uh as for my understanding i we don't think that null null pointer would be a valid one because for internal load sir number of children must satisfy so null pointer is not a valid one so here number of children is four okay in this example though this was out of track example but here there is a children but there is no association so there is a address there is a pointer but that is not that if we if we consider null pointer as valid sir then in case of skew tree also that would also be like b tree that would also follow the property of b tree because in this case this would be the internal node right 68 70 and 25 then it's q tree also we can consider that okay there are null pointers so uh if you consider null i totally agree but that was a special thing someone was discussing so i make but in case of b tree now you will never find this kind of situation no sir basically yeah so basically sir if that's the case that this uh like this merger is invalid basically that is what i want to say yeah yeah so that that was the special thing someone was discussing so i make it but it will never happen in between okay okay okay i think yes hello sir good morning sorry good morning yeah uh actually my question is uh regarding the quiz and assignments uh you told that um you will discuss the questions and assignment questions uh in a lab so we we have completed our quiz one so uh but today it is not possible maybe in the next week we can discuss or next to next week when the classes are going um because then the assignment four will be complete then we are good to go so we will discuss all yeah and also for the quiz one there is a question that have the uh two options was correct yeah so um someone get the marks on uh of that one but someone not getting the marks i think so no no if i have i had i remember the question i had initiated to because uh in height calculation there was a doubt of minus one so i have put both the cases too so if we attempt that you will get the max if someone attempt other than will he or she will get the mark so for both one one marks were there yeah it is not one max will so i intentionally did that because there was a little bit doubt in the height calculation so so that okay sir no problem then thank you you can go now um so my question is on personal thing like i missed the quiz this time um what will impact it will impact it overall overall your grade will be little bit lesser okay because there's no way we can reopen i don't think the team will allow you okay but don't do uh don't worry do good in your end sem marks that is having the highest weightage okay but at least i can see the question sir is it possible that i can see the questions what was because actually someone was previously asking so i have to figure out whether it is possible for me to see also the questions if i see then i will discuss in the in the class so i will check it out okay or i will see i will look into the uh my part where i have maintained a question thing so that i will discuss separately yeah okay thank you you can check your doubt silpy you can go next i think rossan is on mute i just want to ask the labels for assignment three assignment three will be till avl or max to max it will be the properties of mv3 not beyond that okay thank you sir okay i guess everyone is done thank you thank you yes sir thank you sir