1
00:00:01,520 --> 00:00:02,180
Hi, everyone.

2
00:00:02,210 --> 00:00:06,770
So in the last video, we implemented our insert function, not the only function remaining with us

3
00:00:06,770 --> 00:00:09,170
to implement is actually remove minimum function.

4
00:00:11,150 --> 00:00:15,030
So I want you guys to implement this removed minimum function.

5
00:00:15,350 --> 00:00:18,260
So let me explain it to you, how you will be able to implement this.

6
00:00:18,650 --> 00:00:20,510
So let us consider one example first.

7
00:00:20,540 --> 00:00:26,840
So this is less certain than, let's say, 20 or so under 30 and led to 40.

8
00:00:28,250 --> 00:00:33,050
So you have this ability and let's say you want to delete.

9
00:00:34,070 --> 00:00:38,750
So I have the function removed minimum, so removed minimum function, it will delete the top most relevant

10
00:00:38,750 --> 00:00:41,710
because the topmost element is the minimum element.

11
00:00:41,990 --> 00:00:43,190
So I want to delete 10.

12
00:00:47,760 --> 00:00:54,870
So these are my values, so 10, 20, then 100, then I have 30 here and then I have 40 here.

13
00:00:55,970 --> 00:01:02,080
So, again, we have discussed many times how we will do so, I will step in with 40 simple.

14
00:01:02,240 --> 00:01:04,230
So here I will step 10 and 14.

15
00:01:04,250 --> 00:01:06,950
So these are the indexes, zero, one, two, three, four.

16
00:01:07,190 --> 00:01:12,950
And if you do not want to create a vector, you cannot predict indexes here, zero, one, two, three

17
00:01:12,950 --> 00:01:13,430
and four.

18
00:01:14,520 --> 00:01:21,160
Simple, so first step is very simple, what we will do, so you will up the element that you want.

19
00:01:21,510 --> 00:01:25,120
Basically, I want to delete this element of the lost index.

20
00:01:25,470 --> 00:01:26,540
So this is index.

21
00:01:26,550 --> 00:01:29,370
This is the first index and last index is actually four.

22
00:01:30,150 --> 00:01:32,110
So first you will snap, then what you will do.

23
00:01:32,130 --> 00:01:37,610
So this is actually be corrected, then you will be back.

24
00:01:38,520 --> 00:01:40,440
So if you will be good or bad back.

25
00:01:40,460 --> 00:01:41,170
So this is.

26
00:01:41,910 --> 00:01:42,780
This is 40.

27
00:01:43,140 --> 00:01:50,940
So after writing back, this element will be removed and similarly so 40 will come here and then will

28
00:01:50,940 --> 00:01:53,580
come here and this element will be removed.

29
00:01:55,360 --> 00:01:55,930
Simple.

30
00:01:56,980 --> 00:01:59,120
Now, our work is not over here.

31
00:01:59,560 --> 00:02:05,500
So what we have to do, so now we have to satisfy the many property, many properties currently not

32
00:02:05,500 --> 00:02:06,150
satisfied.

33
00:02:06,520 --> 00:02:09,880
So we have to satisfy our mini property and how can we do that?

34
00:02:11,050 --> 00:02:12,500
So let's make.

35
00:02:12,700 --> 00:02:16,350
So this is my painting because this is my left index.

36
00:02:16,360 --> 00:02:17,980
This is my right index.

37
00:02:18,850 --> 00:02:21,040
So this is your paint index.

38
00:02:21,040 --> 00:02:24,040
So indexes zero, actually, but they have to do so.

39
00:02:24,040 --> 00:02:26,650
You have to compare for David Gurantee and Hundred.

40
00:02:26,980 --> 00:02:28,560
So find out the left index.

41
00:02:28,900 --> 00:02:30,220
The formula is very simple.

42
00:02:30,220 --> 00:02:32,890
Do a plus one and the way plus two.

43
00:02:34,330 --> 00:02:40,360
So left index is one right index is actually two, and where do you have to do so?

44
00:02:40,360 --> 00:02:44,570
You have to compare 40 with so among these three numbers, so.

45
00:02:44,590 --> 00:02:48,200
Forty 20 and under, you have to find out the minimum number.

46
00:02:48,580 --> 00:02:52,060
And among these three numbers, 20 is the minimum number.

47
00:02:52,630 --> 00:02:56,330
So what will happen to 40 will get slapped with 20.

48
00:02:56,350 --> 00:02:59,540
So 20 will come here and 40 will come here.

49
00:02:59,770 --> 00:03:01,600
We have done this thing many, many times.

50
00:03:01,960 --> 00:03:03,130
OK, so what will happen?

51
00:03:03,580 --> 00:03:07,620
And let us also maintain the index of the minimum element.

52
00:03:08,230 --> 00:03:11,280
So the minimum element was 20 and the index of 20 was one.

53
00:03:11,560 --> 00:03:12,820
So I will write one here.

54
00:03:13,480 --> 00:03:16,300
OK, again, maintaining the index of the smallest element.

55
00:03:16,570 --> 00:03:18,060
So the smallest element was one.

56
00:03:18,250 --> 00:03:21,690
So I'm writing my minimum index here and what they have to do.

57
00:03:21,700 --> 00:03:27,490
So you have to compare these three things being the next child index and the index and then you will

58
00:03:27,490 --> 00:03:28,270
do the sweeping.

59
00:03:29,560 --> 00:03:33,390
So I'm comparing the pain index with the index and the real index.

60
00:03:33,400 --> 00:03:37,810
And I will also maintain a variable minimum index and that will store the variable.

61
00:03:39,200 --> 00:03:41,480
It was the index having the smallest element.

62
00:03:41,780 --> 00:03:42,980
Now, what will happen?

63
00:03:43,280 --> 00:03:49,980
So now I have to compare 40 with its left index, which is 30 and it's right next doesn't exist anymore.

64
00:03:50,540 --> 00:03:52,760
So what does the index 40, what is the value?

65
00:03:52,790 --> 00:03:56,630
Where does the index for element for these indexes when she actually this one.

66
00:03:58,310 --> 00:04:00,290
Now, my parent index is actually one.

67
00:04:01,370 --> 00:04:05,030
So what is left along the way, plus one, which is three?

68
00:04:06,040 --> 00:04:13,330
And it's right next to a place to which is food, so the right index is food and this is actually out

69
00:04:13,330 --> 00:04:13,900
of orange.

70
00:04:15,860 --> 00:04:23,030
Index four is not valid because right now we have only four elements, so the maximum index is three.

71
00:04:23,720 --> 00:04:29,690
So in this case, you will not basically you will calculate your children next, but then you will discard

72
00:04:29,690 --> 00:04:31,700
this index because it is out of range.

73
00:04:32,090 --> 00:04:34,070
So you will compare only these two elements.

74
00:04:35,110 --> 00:04:37,060
We have only these two elements to compare.

75
00:04:37,330 --> 00:04:40,780
So I will compare Element 40 with elementally.

76
00:04:41,970 --> 00:04:47,760
So what what will happen to these two elements will get swept so tightly, so it will become faulty

77
00:04:48,240 --> 00:04:49,740
and it will become dirty.

78
00:04:50,550 --> 00:04:55,020
And again, I have to update my index hominum index today was the smallest element.

79
00:04:55,350 --> 00:04:56,730
So the minimum index is three.

80
00:04:57,090 --> 00:04:58,410
So I will write three here.

81
00:04:59,130 --> 00:04:59,700
Simple.

82
00:05:00,210 --> 00:05:02,490
Then your parent index will become three.

83
00:05:05,470 --> 00:05:08,050
Your building next will become tiny because 40.

84
00:05:09,140 --> 00:05:11,580
You can see 40 is present at the next tree.

85
00:05:12,060 --> 00:05:12,990
Now, what will happen?

86
00:05:13,520 --> 00:05:16,130
So basically, again, you will find out you are left.

87
00:05:16,170 --> 00:05:20,900
Julian Dixon, right next to left index will come out the way.

88
00:05:21,410 --> 00:05:22,940
So doing two, three, seven.

89
00:05:23,270 --> 00:05:29,630
So left Nexus seven and right Nix's eight and both these are indexes are actually out of range.

90
00:05:31,010 --> 00:05:35,420
Both these indexes are actually out of range, so they have to do you have only one element?

91
00:05:36,420 --> 00:05:41,670
And then you will update your minimum index, so minimum index is obviously three, because you have

92
00:05:41,670 --> 00:05:44,070
only one element of this element to the smallest element.

93
00:05:44,580 --> 00:05:49,650
Then you can see basically your Behrend index becomes equal to the minimum index.

94
00:05:49,650 --> 00:05:51,030
At that point, you will stop.

95
00:05:52,040 --> 00:05:53,630
At this point, we will stop.

96
00:05:55,560 --> 00:05:59,910
So when the brand index becomes equal to the minimum index.

97
00:06:01,370 --> 00:06:09,680
That means our property, so this means that our mini property has been satisfied so I can stop.

98
00:06:12,500 --> 00:06:16,970
So I hope you guys can implement this code, so please give it a try.

99
00:06:17,150 --> 00:06:18,370
I will explain the code.

100
00:06:18,380 --> 00:06:20,120
I will write the code in the next video.

101
00:06:20,150 --> 00:06:21,000
I will see you there.

102
00:06:21,020 --> 00:06:21,440
Bye bye.

