1
00:00:01,890 --> 00:00:02,580
Hi, everyone.

2
00:00:02,610 --> 00:00:09,030
So in this video, we will talk about rehashing so as discussed in the last video, we will calculate

3
00:00:09,030 --> 00:00:14,970
our load factor and when the Lord will become greater than zero point seven, what we will do, we will

4
00:00:14,970 --> 00:00:18,780
do reaction now when we calculate our load factor.

5
00:00:19,170 --> 00:00:22,530
So we will calculate load factor inside the insert function.

6
00:00:22,530 --> 00:00:25,970
So we have written the code search insert function that will insert the key and the value.

7
00:00:26,340 --> 00:00:31,790
So after inserting the key and the value at last, what we will do, we will calculate our load factor.

8
00:00:31,950 --> 00:00:37,890
And if the load factor came out bigger than zero point seven, then what we will do, we will do rehashing.

9
00:00:38,970 --> 00:00:45,900
Now, how we will do reaction, so initially our budget that we have created our budget area of size

10
00:00:45,900 --> 00:00:54,540
five to this is our budgetary size five now 40, but we have to do we have to create an array of double

11
00:00:54,550 --> 00:00:54,950
size.

12
00:00:55,560 --> 00:01:00,890
So I will create an area of size 10 because initially our area was a size five.

13
00:01:01,140 --> 00:01:03,070
So now our area is also Austin.

14
00:01:03,660 --> 00:01:09,900
So after creating the area, what we will do, we will put everywhere because it is containing the garbage

15
00:01:09,900 --> 00:01:10,220
address.

16
00:01:10,290 --> 00:01:12,000
So I will put everywhere.

17
00:01:13,600 --> 00:01:21,040
Now, what I will do, I will take a temporary variable so this temp will point towards this area and

18
00:01:21,040 --> 00:01:26,120
my budget will now point towards this new budget, very simple.

19
00:01:26,470 --> 00:01:34,690
Now, after doing this, what we have to do, we will traverse on temporary, we will traverse on temporary.

20
00:01:35,050 --> 00:01:38,680
And at each index, I have a linked list.

21
00:01:39,490 --> 00:01:42,120
So I will also traverse on the long list.

22
00:01:43,300 --> 00:01:47,760
So I am traversing on that temporary area and at each index linked list.

23
00:01:47,770 --> 00:01:56,020
So I will also travel on the list and I will rehash every key value before I will insert every key value

24
00:01:56,380 --> 00:01:58,120
inside this new bucket.

25
00:01:59,020 --> 00:01:59,560
Simple.

26
00:02:00,160 --> 00:02:03,330
Now one obvious question that might come to your mind.

27
00:02:03,700 --> 00:02:08,650
So if this is next to let's say this is index three.

28
00:02:10,000 --> 00:02:14,840
So these three nodes, let's say these are the next three.

29
00:02:15,160 --> 00:02:18,370
So in the new area, so this is a new area of station.

30
00:02:18,610 --> 00:02:23,860
So is all the key nodes will represented in this tree in the new area or not?

31
00:02:24,460 --> 00:02:25,690
I'm repeating my question.

32
00:02:26,050 --> 00:02:30,930
So one obvious doubt that might come into your mind is at the next three.

33
00:02:31,660 --> 00:02:32,640
So this is extreme.

34
00:02:32,980 --> 00:02:36,400
So suppose this is the next three and next to suppose there are three nodes.

35
00:02:37,520 --> 00:02:42,650
Now, when you will rehash, basically when you will insert these Nold, these guadaloupe inside this

36
00:02:42,650 --> 00:02:48,200
new area of southeastern, so will all these three nodes will come in next to you or not?

37
00:02:49,320 --> 00:02:54,840
So my answer is no, it won't, because let's say let's consider two things here.

38
00:02:54,870 --> 00:02:58,950
So this is ABC, Gey, ABC, and this is the ETF.

39
00:03:01,640 --> 00:03:11,900
So let us discuss about this temporary now this GBC, let us try to find out, it's called a high school

40
00:03:11,900 --> 00:03:13,880
is basically independent of budget size.

41
00:03:14,330 --> 00:03:16,050
So high school they came out to be it.

42
00:03:16,610 --> 00:03:21,680
Now, let us also calculate the score for the ETF and let's say its high school came out with 13.

43
00:03:22,760 --> 00:03:29,010
And then what we have to do for finding out the index, we will we will take percentage, five percent.

44
00:03:29,020 --> 00:03:32,360
This Birgitta's to the index came out to be three.

45
00:03:32,630 --> 00:03:35,170
And similarly, the index came out to be three.

46
00:03:35,420 --> 00:03:39,140
So that's why ABC and the if they are present at the next three.

47
00:03:40,160 --> 00:03:40,720
Simple.

48
00:03:41,390 --> 00:03:45,910
Now if you will push ABC and the ETF at the next three here.

49
00:03:46,160 --> 00:03:47,990
So suppose you push ABC.

50
00:03:48,910 --> 00:03:56,290
And the F at the next three, you just blindly copied all the linked list.

51
00:03:57,880 --> 00:04:04,240
At an extreme, you just blindly copied this only linked list at the next tree in the new area.

52
00:04:05,110 --> 00:04:10,420
Now, when the new area I want to search, so for example, I want to search the guilty.

53
00:04:10,450 --> 00:04:12,400
If so, what will happen?

54
00:04:13,000 --> 00:04:16,690
So for searching the key, first of all, I will try to find out.

55
00:04:16,690 --> 00:04:21,850
Attash also called came out with Hardeen because his code is independent of the pocket size.

56
00:04:22,240 --> 00:04:29,600
Then what I will do, I will write more down to Morton came out to be three, so I will go to the next

57
00:04:29,600 --> 00:04:31,550
tree and then I will search this linked list.

58
00:04:31,580 --> 00:04:34,690
Yes, the is present, so I will retain its value.

59
00:04:35,020 --> 00:04:38,500
So little value was do so I will return the value to simple.

60
00:04:39,190 --> 00:04:41,130
Now let us take the case for ABC.

61
00:04:41,830 --> 00:04:42,940
So you have ABC.

62
00:04:43,960 --> 00:04:49,480
Now, again, we will calculate the harsh cold, so harsh cold came out to be it, because it is independent

63
00:04:49,480 --> 00:04:49,930
of the.

64
00:04:51,020 --> 00:04:57,220
Because then I will do more then, so it came out to eat, so what I will do, I will go to index it.

65
00:04:57,230 --> 00:05:00,890
So suppose this is index eight, I will go to index it.

66
00:05:00,890 --> 00:05:03,530
And this will also have a link list.

67
00:05:04,200 --> 00:05:07,520
And now what I will do, I will traverse over this link list.

68
00:05:07,880 --> 00:05:09,450
And ABC is not present there.

69
00:05:09,470 --> 00:05:11,600
So what I will do, I will return that.

70
00:05:11,600 --> 00:05:15,110
ABC is not present and I will return a garbage value zero.

71
00:05:15,920 --> 00:05:22,790
Obviously this is wrong because ABC is presented the next three, so that means you cannot blindly copy.

72
00:05:23,810 --> 00:05:28,730
So that means you cannot blindly copy the linked list which was presented the next three.

73
00:05:29,630 --> 00:05:31,490
To the new area at the next.

74
00:05:32,780 --> 00:05:39,530
So what we have to do, this is my temporary I will agree to my temporary.

75
00:05:40,750 --> 00:05:48,900
And at each index, at each market index, what I will do so I will call insert function on this note,

76
00:05:48,910 --> 00:05:53,410
I will call insert function on this note and these notes will be inserted in.

77
00:05:54,400 --> 00:06:01,960
This budgetary, you just cannot blindly copy the whole list and based it here, you cannot do that

78
00:06:02,620 --> 00:06:04,480
because this problem will appear.

79
00:06:05,790 --> 00:06:13,170
Because of the different sizes, different sizes, so the approach is very simple for rehashing, we

80
00:06:13,170 --> 00:06:20,130
will traverse over the time period and for each index we will traverse the link list and for each node

81
00:06:20,130 --> 00:06:25,710
I will call the insert function and insert will insert the key value pair and this new bucket, very

82
00:06:26,070 --> 00:06:26,660
simple.

83
00:06:27,750 --> 00:06:30,710
I'll get the letters, write the call so that you can understand it better.

84
00:06:36,900 --> 00:06:38,560
So where is insert function?

85
00:06:38,580 --> 00:06:45,540
So this is my insert function now after doing countless plays, what we will do will calculate our load

86
00:06:45,540 --> 00:06:46,020
factor.

87
00:06:48,250 --> 00:06:49,540
So the billboard factor.

88
00:06:52,210 --> 00:06:57,310
So what is load, factor and baby and is the total number of entries, so total number of entries is

89
00:06:57,310 --> 00:06:58,340
actually gone?

90
00:06:59,050 --> 00:07:01,260
So I will do count divided by number.

91
00:07:01,360 --> 00:07:01,630
It's.

92
00:07:05,410 --> 00:07:07,200
So is this right or wrong?

93
00:07:07,240 --> 00:07:09,260
So this is actually wrong, right?

94
00:07:09,280 --> 00:07:13,150
This is wrong because it is integer integer division.

95
00:07:13,420 --> 00:07:15,800
So Integer Integer is actually in BGN.

96
00:07:15,820 --> 00:07:20,020
So if you will divide so let's say the count is four and number it is five.

97
00:07:20,260 --> 00:07:22,540
So ideally you should get zero point eight.

98
00:07:22,780 --> 00:07:25,910
But this is in integer division, so you will get zero.

99
00:07:26,860 --> 00:07:28,180
So I want zero point eight.

100
00:07:28,210 --> 00:07:35,620
So what I will do, I will write like this one point zero, multiply, count and then hold divided by

101
00:07:35,800 --> 00:07:36,670
number it's.

102
00:07:41,060 --> 00:07:43,860
So 1.0 then multiplied count.

103
00:07:44,450 --> 00:07:46,400
So now it is float by.

104
00:07:47,520 --> 00:07:52,500
Integer, so the output will be a double value of float value and then you can check.

105
00:07:53,280 --> 00:07:53,970
So if.

106
00:07:55,880 --> 00:08:02,600
The load factor is greater than zero point seven, then they have to do you have to do rehashing.

107
00:08:03,050 --> 00:08:05,860
So the code of creation is going to be very, very large.

108
00:08:05,870 --> 00:08:11,570
So what I will do, I will create a separate function and let us call it function research.

109
00:08:12,800 --> 00:08:17,560
So if the load factor is good, then zero point seven I will call a function rehash.

110
00:08:17,960 --> 00:08:24,020
Now let's write the code for the hash so it is obvious that the hash function will be a private function.

111
00:08:28,170 --> 00:08:29,920
So the return type will be void.

112
00:08:29,940 --> 00:08:31,230
It will not return anything.

113
00:08:32,039 --> 00:08:33,720
The name of the function is Rieche.

114
00:08:39,010 --> 00:08:40,610
So what does Rieche function will do?

115
00:08:40,630 --> 00:08:43,120
So I told you we will create a temp.

116
00:08:46,120 --> 00:08:48,040
So this is my map Naude.

117
00:08:52,730 --> 00:08:56,240
This stamp will point towards the bucket.

118
00:08:58,500 --> 00:09:05,840
And now what we have to do so this budget, it will point towards the new every.

119
00:09:07,050 --> 00:09:08,070
Of double size.

120
00:09:14,970 --> 00:09:18,420
Societies will be double two times of no decades.

121
00:09:21,880 --> 00:09:25,100
Through times of no goods, then what do you have to do?

122
00:09:25,120 --> 00:09:29,860
So initially this containing the garbage address, so we have to initialize it with null so you can

123
00:09:29,860 --> 00:09:31,760
see what they have to do.

124
00:09:32,350 --> 00:09:35,310
So initially our bucket was of size.

125
00:09:35,890 --> 00:09:37,560
So this was an initial area five.

126
00:09:38,200 --> 00:09:40,540
Now this is my new budgetary.

127
00:09:41,700 --> 00:09:47,310
So initially, Buckett was pointing towards this, but what we did, we created a temporary tempest

128
00:09:47,310 --> 00:09:55,230
pointing towards this Alduin and Buckett is pointing towards this new one initially discontinued garbagey

129
00:09:55,230 --> 00:09:55,550
address.

130
00:09:55,560 --> 00:09:57,650
So garbagey, this is dangerous.

131
00:09:57,660 --> 00:09:59,370
So we will initialize it with null.

132
00:10:07,130 --> 00:10:12,040
So I am initializing it with also the sizes two times of no good.

133
00:10:25,790 --> 00:10:28,370
Now, after Initializing Bednall, but we have to do.

134
00:10:30,570 --> 00:10:32,560
We have to initialize all of their properties.

135
00:10:33,300 --> 00:10:35,740
So what do I mean by all of the properties?

136
00:10:35,790 --> 00:10:42,210
So for this new Beckert sofa, this new Buckethead, the counter zero, because it is not containing

137
00:10:42,240 --> 00:10:42,940
any element.

138
00:10:43,500 --> 00:10:46,350
And similarly, I have to upgrade the size.

139
00:10:46,360 --> 00:10:49,240
So I have a very old no kids, but I have to do so.

140
00:10:49,260 --> 00:10:51,050
No kids multiply equals two.

141
00:10:51,840 --> 00:10:55,820
And since we had a building the size like this store, the original size.

142
00:10:56,700 --> 00:10:57,780
So let's do that.

143
00:11:00,170 --> 00:11:04,670
So what I'm doing right now scared a very well oiled but good size.

144
00:11:07,720 --> 00:11:11,190
So it is all about could say, so this is going to be no kids.

145
00:11:12,240 --> 00:11:13,040
No, it's.

146
00:11:16,360 --> 00:11:18,910
Now, what we have to do, so I will update.

147
00:11:22,350 --> 00:11:25,120
So this will get multiplied by two.

148
00:11:25,830 --> 00:11:27,320
And what is the value of count?

149
00:11:27,330 --> 00:11:34,170
So initially in my bucket said there are zero elements, so this is my new book, etc. So zero elements

150
00:11:34,170 --> 00:11:34,430
are there.

151
00:11:34,440 --> 00:11:36,480
So that's why I have to initialize count again.

152
00:11:37,350 --> 00:11:39,720
Simple now as discussed.

153
00:11:39,730 --> 00:11:44,910
But we have to do we have to do rehashing so far, rehashing what I have to do.

154
00:11:45,090 --> 00:11:51,010
I will iterate over the temporary and for each bucket what I will do, I will add it over the linked

155
00:11:51,030 --> 00:11:53,550
list and I will call insert function simple.

156
00:11:56,900 --> 00:12:05,070
So I have to add it all the time, Betty, so in order to hydrate, so I equals zero, I then.

157
00:12:05,150 --> 00:12:06,050
So what is the size?

158
00:12:06,080 --> 00:12:08,180
So this is the size of the bucket size.

159
00:12:10,860 --> 00:12:11,790
I placeless.

160
00:12:14,360 --> 00:12:17,390
Now, let's try to find out the head.

161
00:12:19,380 --> 00:12:21,690
So what is head head is actually a temp of a.

162
00:12:23,110 --> 00:12:27,610
Simple and then what we have to do, so we have to operate over the list.

163
00:12:29,150 --> 00:12:31,220
So while it is not a questionable.

164
00:12:32,790 --> 00:12:35,820
So I have to iterate over the long list, so we had equals.

165
00:12:37,960 --> 00:12:38,770
Next offered.

166
00:12:42,320 --> 00:12:46,020
Now, what we have to do, so let us try to find out the key and the value.

167
00:12:46,580 --> 00:12:49,700
So what is key so stinky is.

168
00:12:52,120 --> 00:12:52,940
Haruki.

169
00:12:57,840 --> 00:13:01,320
And what is value so we value?

170
00:13:03,800 --> 00:13:04,340
It is.

171
00:13:06,180 --> 00:13:07,070
Hadero value.

172
00:13:09,040 --> 00:13:10,750
Simple, then what do you have to do?

173
00:13:10,780 --> 00:13:16,270
You have to call the insert function, insert function will take and it will take value.

174
00:13:17,820 --> 00:13:20,460
So if you'll see carefully the insert function.

175
00:13:21,750 --> 00:13:28,830
So inside function and started, the key will appear in the gallery, so you can see with the obligatory

176
00:13:29,340 --> 00:13:31,400
so see it is inserting in the buckets.

177
00:13:31,950 --> 00:13:33,540
So what will happen?

178
00:13:35,020 --> 00:13:38,260
These new nodes will get inserted inside the Buckets said.

179
00:13:40,410 --> 00:13:40,800
So.

180
00:13:41,920 --> 00:13:49,050
These new nodes will get inserted inside this Bucklebury, which was containing initially zero elements,

181
00:13:49,060 --> 00:13:54,310
so this count will increase automatically because we have written the logic inside the insert function.

182
00:13:54,610 --> 00:13:55,080
Simple.

183
00:13:56,170 --> 00:13:57,730
Now, what we have done till now.

184
00:13:59,110 --> 00:14:01,270
So basically, you have this temporary.

185
00:14:03,230 --> 00:14:09,440
The size was five and you have decided then you have this area of size and this is buckets.

186
00:14:11,870 --> 00:14:12,920
So the system, Betty.

187
00:14:15,850 --> 00:14:20,940
And this has the linked list, so now what we have done.

188
00:14:20,980 --> 00:14:27,190
We are trading on the time period and then we are trading on the long list and then all the key value-based

189
00:14:27,190 --> 00:14:33,010
are pushed inside this budgetary all the way, little bit inserted inside this bucket area.

190
00:14:33,550 --> 00:14:35,480
Now, we do not need this at animal.

191
00:14:36,400 --> 00:14:37,800
We do not need this idea anymore.

192
00:14:37,810 --> 00:14:40,530
So it will look we will treat all the temporary area again.

193
00:14:40,960 --> 00:14:42,880
First, we will delete the linked list.

194
00:14:43,330 --> 00:14:44,410
Then we will delete the.

195
00:14:45,700 --> 00:14:47,860
So first we will delete all the linked list.

196
00:14:48,840 --> 00:14:53,960
And then we will delete the term very simple, because we do not need it anymore.

197
00:14:58,730 --> 00:15:05,630
So it's time to delete the temporize or for deleting the temporary, we relied it because first we have

198
00:15:05,630 --> 00:15:09,560
to delete the linked list so all of it says.

199
00:15:12,110 --> 00:15:13,130
Let's copy this one.

200
00:15:18,700 --> 00:15:19,570
I placeless.

201
00:15:21,050 --> 00:15:26,090
So for the leading the list, what you can do, we can right delete them.

202
00:15:26,090 --> 00:15:31,460
BofI because Tambov is containing the head and this is a recursive function.

203
00:15:31,470 --> 00:15:34,580
So compiling a list will be destroyed.

204
00:15:35,270 --> 00:15:37,160
And then after deleting the list.

205
00:15:38,130 --> 00:15:39,540
We can delete the temporary.

206
00:15:43,520 --> 00:15:48,600
So now they can dilute the temperature so our rehabs function is done.

207
00:15:50,090 --> 00:15:52,440
Hopefully our rehab function should work fine.

208
00:15:52,910 --> 00:15:55,520
So now let us write the code for testing our map.

209
00:15:59,010 --> 00:16:01,480
So let us create my map.

210
00:16:02,190 --> 00:16:08,100
The keys are sitting and the values, let's say, are integers and led to the name of map is MAP.

211
00:16:12,320 --> 00:16:13,730
Let's name it our map.

212
00:16:17,730 --> 00:16:21,250
So now let us push them into this, so let's push.

213
00:16:22,050 --> 00:16:26,280
So I want to push 10 entries so I list and then I placeless.

214
00:16:27,270 --> 00:16:35,370
Now, let's try to find out the key and the value, so character, see, so character, see what it

215
00:16:35,370 --> 00:16:35,940
will contain.

216
00:16:36,890 --> 00:16:38,930
Let's say it is zero.

217
00:16:40,020 --> 00:16:40,770
Plus a.

218
00:16:42,200 --> 00:16:45,230
And then let us create a GUI so stinky.

219
00:16:48,200 --> 00:16:50,030
Let's say this is ABC.

220
00:16:51,940 --> 00:16:52,570
And then.

221
00:16:54,030 --> 00:16:54,780
Giclas.

222
00:16:56,200 --> 00:16:58,850
Gabler's See the character, see?

223
00:17:00,320 --> 00:17:05,329
I will explain what I am doing, so let me do it first, then what do you want?

224
00:17:05,339 --> 00:17:07,940
So let's see, our value is.

225
00:17:09,530 --> 00:17:10,400
I plus one.

226
00:17:14,910 --> 00:17:19,859
And then let's see, let's call the function, insert our map dot.

227
00:17:21,109 --> 00:17:24,589
Insert it will take and it will take value.

228
00:17:27,880 --> 00:17:30,370
And now let us print the size.

229
00:17:31,700 --> 00:17:33,170
So our map Ghazi's.

230
00:17:39,890 --> 00:17:43,280
OK, so what I'm doing here now, I'm explaining to you.

231
00:17:45,350 --> 00:17:52,250
So first time creating our map that gives our strength and the values that integer, so I am pushing

232
00:17:52,250 --> 00:18:01,190
the data of this type exito, this is the key and value is one second key is ABC one and values two.

233
00:18:01,370 --> 00:18:02,360
So it will go on.

234
00:18:02,510 --> 00:18:06,810
So my last key will be ABC nine and the value is ten.

235
00:18:07,190 --> 00:18:07,940
So what I'm doing.

236
00:18:07,940 --> 00:18:09,350
So this is character zero.

237
00:18:10,770 --> 00:18:17,670
So this is correct, zero then plus I saw zero zero, so it will become character zero, so zero plus

238
00:18:17,670 --> 00:18:19,400
one, so it will become character one.

239
00:18:20,160 --> 00:18:22,230
And then this is Mike EBC.

240
00:18:22,440 --> 00:18:24,350
Then I am appending the character.

241
00:18:24,420 --> 00:18:29,540
See, so that's why ABC zero, ABC one, ABC nine and my values lesson.

242
00:18:29,580 --> 00:18:33,240
So starting from one to ten because the value of AI is from zero to nine.

243
00:18:34,180 --> 00:18:38,920
And then I'm calling the insert function, I'm giving the key and the value, so this will be my key

244
00:18:38,920 --> 00:18:39,520
value pair.

245
00:18:41,730 --> 00:18:43,500
And then I am bringing out the.

246
00:18:43,860 --> 00:18:46,290
So how many elements are there, certain elements are there?

247
00:18:46,710 --> 00:18:47,910
So output should be 10.

248
00:18:50,880 --> 00:18:52,140
So let's turn our program.

249
00:18:58,050 --> 00:18:59,610
So this will be Capital V..

250
00:19:07,190 --> 00:19:10,160
So the size of the map is bent because there are 10 entries.

251
00:19:11,740 --> 00:19:13,270
Now, let us also write a function.

252
00:19:18,740 --> 00:19:26,300
So actually, let us write a function that does the public function get load factor so that we can see

253
00:19:26,300 --> 00:19:27,220
what is the load factor.

254
00:19:27,230 --> 00:19:28,280
So get.

255
00:19:30,250 --> 00:19:31,060
Lord Victor.

256
00:19:34,230 --> 00:19:35,550
So what this function will do?

257
00:19:39,190 --> 00:19:47,500
It will simply witness what is the current load factor, so return one point zero, multiply count.

258
00:19:51,570 --> 00:19:53,010
Divided, no, it's.

259
00:19:58,510 --> 00:20:04,780
And when you're inserting so after inserting it as well to try to find out, let us also try to print.

260
00:20:06,630 --> 00:20:15,870
Load factors, work out our map, not get the load factor so that it says get load factor.

261
00:20:21,220 --> 00:20:24,040
So they're destroying our program and let's see what the output.

262
00:20:28,050 --> 00:20:29,340
So this is the load factor.

263
00:20:29,680 --> 00:20:31,080
Now let's try to analyze.

264
00:20:34,810 --> 00:20:37,310
So initially, our bucket size was five.

265
00:20:37,750 --> 00:20:43,030
So when you're pushing the first element, so the load factor will become one by five, so which is

266
00:20:43,030 --> 00:20:43,780
zero point two.

267
00:20:45,180 --> 00:20:49,580
Then you push the second elements to effectively become a two by five, so this is zero point four.

268
00:20:49,770 --> 00:20:51,570
It is still less than zero point seven.

269
00:20:51,570 --> 00:20:54,570
So nobody saying zero point less than zero point seven.

270
00:20:54,580 --> 00:20:59,240
So no reaction yet, pushing the third element, three by five, which is zero point six.

271
00:20:59,240 --> 00:21:01,350
So zero point six is less than zero point seven.

272
00:21:01,610 --> 00:21:02,210
No reaction.

273
00:21:02,700 --> 00:21:05,180
Now, look at this one fourth character.

274
00:21:05,200 --> 00:21:06,930
So this is four by five.

275
00:21:06,940 --> 00:21:08,220
You are pushing the fourth element.

276
00:21:08,550 --> 00:21:11,820
So four by five is actually zero point eight and zero point.

277
00:21:11,820 --> 00:21:13,760
It is actually greater than zero point seven.

278
00:21:14,010 --> 00:21:14,940
So what will happen?

279
00:21:16,260 --> 00:21:17,550
Rehashing will take place.

280
00:21:18,730 --> 00:21:22,660
So when reaction will take place, my bigotry will become of substance.

281
00:21:23,500 --> 00:21:29,450
So this will become for Biden and what is four by 10, zero point four.

282
00:21:29,470 --> 00:21:34,650
So 10 is the new bucket size and forward is basically the total number of entries.

283
00:21:34,660 --> 00:21:36,010
So that's why zero point four.

284
00:21:36,070 --> 00:21:36,430
OK.

285
00:21:37,560 --> 00:21:39,810
Similarly, it will be five by 10.

286
00:21:41,340 --> 00:21:47,880
Five by ten, six by ten, seven by ten, then look at this, eight by ten, so it by then, so eight

287
00:21:47,880 --> 00:21:50,250
by ten is basically zero point eight and zero point.

288
00:21:50,250 --> 00:21:51,630
It is a good zero point seven.

289
00:21:51,660 --> 00:21:53,940
So what will happen rehashing will again take place.

290
00:21:55,770 --> 00:22:00,020
So two times the recession is taking place, so this is the first time we did recession.

291
00:22:00,930 --> 00:22:02,890
Now we are doing rehashing the second time.

292
00:22:03,180 --> 00:22:03,960
So what will happen?

293
00:22:03,970 --> 00:22:10,850
My editors, my budget say will become 20 and will my lord will become eight by 20.

294
00:22:11,250 --> 00:22:12,000
So what is it by.

295
00:22:12,420 --> 00:22:13,230
So this is.

296
00:22:14,270 --> 00:22:21,470
Two by five and two by five, zero point four, so that's why zero point four came here, then nine

297
00:22:21,470 --> 00:22:24,800
by five, so nine by five is actually zero point four five.

298
00:22:24,800 --> 00:22:27,140
So that is sorry, this is nine by 20.

299
00:22:27,890 --> 00:22:30,260
So Nightmare 20 came out of zero point four.

300
00:22:30,260 --> 00:22:31,340
Five is the load factor.

301
00:22:31,640 --> 00:22:33,380
So we are doing rehashing two times.

302
00:22:33,380 --> 00:22:39,350
So this is the first time and this is the second time we are doing leashing and my bucket size is 20.

303
00:22:39,350 --> 00:22:42,050
So now let us try to get all the values.

304
00:22:47,130 --> 00:22:51,690
So we are pushing the values now, let us try to find out all the values.

305
00:22:56,940 --> 00:22:59,190
So what they are doing here, let us remove this one.

306
00:23:02,710 --> 00:23:04,840
So let us find out all the values.

307
00:23:04,870 --> 00:23:09,130
So this is key, and instead of calling on insert function.

308
00:23:10,230 --> 00:23:11,760
We will get value function.

309
00:23:14,620 --> 00:23:16,210
And I will give guys input.

310
00:23:19,630 --> 00:23:21,850
So let us print Soucy out.

311
00:23:28,490 --> 00:23:29,390
S.A.G..

312
00:23:31,370 --> 00:23:32,120
And then.

313
00:23:35,300 --> 00:23:37,640
Let us try to get value from this function.

314
00:23:46,420 --> 00:23:52,600
So what I'm doing here, the court is exactly the same, I am deleting the key, I am generating the

315
00:23:52,600 --> 00:23:52,890
value.

316
00:23:52,930 --> 00:23:54,580
So there is no need to generate the value.

317
00:23:54,580 --> 00:23:56,960
We will get value using great value function.

318
00:23:58,120 --> 00:24:03,250
So I am deleting the key, then I am printing the key and finding out the value.

319
00:24:03,250 --> 00:24:07,330
I'm calling to get value function and I'm giving key, simple.

320
00:24:07,660 --> 00:24:09,220
So let's test our program.

321
00:24:13,710 --> 00:24:15,250
OK, so this will be Smolkin.

322
00:24:21,620 --> 00:24:26,100
So, see, we are getting our values so our get value function.

323
00:24:26,300 --> 00:24:29,490
So these are the keys, ABC, ABC zero, ABC and ABC.

324
00:24:29,720 --> 00:24:30,700
And these are the values.

325
00:24:30,710 --> 00:24:32,230
One, two, three, four, DILTON.

326
00:24:32,570 --> 00:24:33,560
So I will get value.

327
00:24:33,560 --> 00:24:34,820
Function is working.

328
00:24:34,820 --> 00:24:35,180
Correct.

329
00:24:35,780 --> 00:24:39,130
Now we have to test one more function Bériot function.

330
00:24:39,350 --> 00:24:40,460
So remove function.

331
00:24:40,520 --> 00:24:43,610
OK, so let us test remove function.

332
00:24:45,870 --> 00:24:47,850
Our map does not remove.

333
00:24:49,440 --> 00:24:56,130
Now, which value we should remove, so let's say I want to remove a key one and.

334
00:24:57,430 --> 00:25:02,290
Let us remove one more key so our map not remove.

335
00:25:06,540 --> 00:25:09,240
And later this time, I want to remove the key six.

336
00:25:11,160 --> 00:25:13,710
So what I'm doing, I am removing two guys.

337
00:25:14,040 --> 00:25:15,120
So what is the value?

338
00:25:15,450 --> 00:25:20,860
So if you can see, I will not be able to find out the game because the key is not present anymore.

339
00:25:21,090 --> 00:25:23,460
So the default value that we are returning is zero.

340
00:25:24,240 --> 00:25:27,950
You can see with the remove function, so see, this is the remove function.

341
00:25:28,320 --> 00:25:30,550
So the default value that I'm returning is zero.

342
00:25:31,380 --> 00:25:39,120
So for KBC even and for ABC six, the default value, the value I will get is zero simple.

343
00:25:39,300 --> 00:25:41,610
And now let's also print the size.

344
00:25:42,030 --> 00:25:43,890
So size should decrease by two.

345
00:25:45,680 --> 00:25:52,760
So output should be it so here, this should be done, then I am deleting the two keys so the get value

346
00:25:52,760 --> 00:25:58,540
for ABC1 and ABC six, they should be zero and the size should be eight.

347
00:25:59,450 --> 00:26:00,800
So let's destroy our program.

348
00:26:06,470 --> 00:26:14,180
So you can see for ABC when the value came out to be zero because we deleted the key ABC one, and similarly

349
00:26:14,180 --> 00:26:21,590
for the ABC six, the value is coming out to be zero because we deleted the key ABC six and initially

350
00:26:21,590 --> 00:26:24,410
outside of Austin, then our site.

351
00:26:24,590 --> 00:26:28,220
Is it because we deleted Loki's Simple.

352
00:26:29,030 --> 00:26:31,340
So our hash map is working fine.

353
00:26:32,610 --> 00:26:38,190
I highly recommend you to read this computer, call yourself, because writing this computer code yourself

354
00:26:38,190 --> 00:26:42,930
makes your concept much, much stronger and also your coding skills will improve a lot.

355
00:26:44,040 --> 00:26:46,700
So whenever integration, we want to use Hashmat.

356
00:26:46,740 --> 00:26:49,660
So what we will use, we will use in hash map.

357
00:26:50,100 --> 00:26:57,720
We will never use the implementation, OK, we will never implementation by ourself in every caution.

358
00:26:57,720 --> 00:26:59,460
We will use the inbuilt hash map.

359
00:27:02,060 --> 00:27:05,710
So if you have any doubt, you can definitely ask me, I will see you in the next one.

360
00:27:05,750 --> 00:27:06,200
Bye bye.

