Hi, everyone.
So in the last video, we implemented our insert function, not the only function remaining with us
to implement is actually remove minimum function.
So I want you guys to implement this removed minimum function.
So let me explain it to you, how you will be able to implement this.
So let us consider one example first.
So this is less certain than, let's say, 20 or so under 30 and led to 40.
So you have this ability and let's say you want to delete.
So I have the function removed minimum, so removed minimum function, it will delete the top most relevant
because the topmost element is the minimum element.
So I want to delete 10.
So these are my values, so 10, 20, then 100, then I have 30 here and then I have 40 here.
So, again, we have discussed many times how we will do so, I will step in with 40 simple.
So here I will step 10 and 14.
So these are the indexes, zero, one, two, three, four.
And if you do not want to create a vector, you cannot predict indexes here, zero, one, two, three
and four.
Simple, so first step is very simple, what we will do, so you will up the element that you want.
Basically, I want to delete this element of the lost index.
So this is index.
This is the first index and last index is actually four.
So first you will snap, then what you will do.
So this is actually be corrected, then you will be back.
So if you will be good or bad back.
So this is.
This is 40.
So after writing back, this element will be removed and similarly so 40 will come here and then will
come here and this element will be removed.
Simple.
Now, our work is not over here.
So what we have to do, so now we have to satisfy the many property, many properties currently not
satisfied.
So we have to satisfy our mini property and how can we do that?
So let's make.
So this is my painting because this is my left index.
This is my right index.
So this is your paint index.
So indexes zero, actually, but they have to do so.
You have to compare for David Gurantee and Hundred.
So find out the left index.
The formula is very simple.
Do a plus one and the way plus two.
So left index is one right index is actually two, and where do you have to do so?
You have to compare 40 with so among these three numbers, so.
Forty 20 and under, you have to find out the minimum number.
And among these three numbers, 20 is the minimum number.
So what will happen to 40 will get slapped with 20.
So 20 will come here and 40 will come here.
We have done this thing many, many times.
OK, so what will happen?
And let us also maintain the index of the minimum element.
So the minimum element was 20 and the index of 20 was one.
So I will write one here.
OK, again, maintaining the index of the smallest element.
So the smallest element was one.
So I'm writing my minimum index here and what they have to do.
So you have to compare these three things being the next child index and the index and then you will
do the sweeping.
So I'm comparing the pain index with the index and the real index.
And I will also maintain a variable minimum index and that will store the variable.
It was the index having the smallest element.
Now, what will happen?
So now I have to compare 40 with its left index, which is 30 and it's right next doesn't exist anymore.
So what does the index 40, what is the value?
Where does the index for element for these indexes when she actually this one.
Now, my parent index is actually one.
So what is left along the way, plus one, which is three?
And it's right next to a place to which is food, so the right index is food and this is actually out
of orange.
Index four is not valid because right now we have only four elements, so the maximum index is three.
So in this case, you will not basically you will calculate your children next, but then you will discard
this index because it is out of range.
So you will compare only these two elements.
We have only these two elements to compare.
So I will compare Element 40 with elementally.
So what what will happen to these two elements will get swept so tightly, so it will become faulty
and it will become dirty.
And again, I have to update my index hominum index today was the smallest element.
So the minimum index is three.
So I will write three here.
Simple.
Then your parent index will become three.
Your building next will become tiny because 40.
You can see 40 is present at the next tree.
Now, what will happen?
So basically, again, you will find out you are left.
Julian Dixon, right next to left index will come out the way.
So doing two, three, seven.
So left Nexus seven and right Nix's eight and both these are indexes are actually out of range.
Both these indexes are actually out of range, so they have to do you have only one element?
And then you will update your minimum index, so minimum index is obviously three, because you have
only one element of this element to the smallest element.
Then you can see basically your Behrend index becomes equal to the minimum index.
At that point, you will stop.
At this point, we will stop.
So when the brand index becomes equal to the minimum index.
That means our property, so this means that our mini property has been satisfied so I can stop.
So I hope you guys can implement this code, so please give it a try.
I will explain the code.
I will write the code in the next video.
I will see you there.
Bye bye.