1
00:00:02,240 --> 00:00:03,950
Hey, guys, what's up?

2
00:00:04,610 --> 00:00:07,750
So today we are going to learn binary search.

3
00:00:08,480 --> 00:00:15,890
OK, so the problem with the Leena's search is that it doesn't take into consideration whether the given

4
00:00:15,890 --> 00:00:17,960
area is Sadr or unsorted.

5
00:00:18,410 --> 00:00:18,680
OK.

6
00:00:19,280 --> 00:00:22,460
So we will use binary search for Sadr, that is.

7
00:00:23,120 --> 00:00:29,480
So there's a condition, condition used by news such as that, and it must be sorted.

8
00:00:30,560 --> 00:00:30,770
OK.

9
00:00:31,070 --> 00:00:34,940
So binary search can only be applied if the given that is sorted.

10
00:00:35,420 --> 00:00:36,920
If the ad is unsorted.

11
00:00:37,550 --> 00:00:39,560
If I have unsorted.

12
00:00:39,560 --> 00:00:39,890
Eddie.

13
00:00:41,160 --> 00:00:44,790
Then binary search cannot be applied.

14
00:00:45,270 --> 00:00:47,960
We have to apply linear search on leave.

15
00:00:48,590 --> 00:00:53,460
OK, so linear search is the only option if we have unsorted erry.

16
00:00:54,660 --> 00:00:59,100
But if we have sorted array, we will always use binary search.

17
00:01:00,340 --> 00:01:00,570
OK.

18
00:01:00,950 --> 00:01:01,640
So let's see.

19
00:01:02,360 --> 00:01:07,370
So we will take an example and we will try to understand how binary search works.

20
00:01:08,700 --> 00:01:11,540
So suppose my days.

21
00:01:11,700 --> 00:01:13,110
So it must be sorted.

22
00:01:14,100 --> 00:01:14,970
So let's see.

23
00:01:21,920 --> 00:01:27,470
So these are indexes zero, one, two, three, four, five, six and seven.

24
00:01:28,370 --> 00:01:37,710
And let's say the values are two, four, five, eight, twenty, twenty, three, forty and 49.

25
00:01:38,480 --> 00:01:38,830
I'll get it.

26
00:01:38,830 --> 00:01:40,040
These are the values.

27
00:01:41,260 --> 00:01:45,810
For example, I want to search for let's say I'm undecided, vote for.

28
00:01:46,840 --> 00:01:48,310
So how about in your search of works?

29
00:01:48,700 --> 00:01:50,140
It takes two pointers.

30
00:01:50,440 --> 00:01:51,530
So this is start.

31
00:01:52,150 --> 00:01:53,700
And this is and.

32
00:01:54,700 --> 00:01:54,940
OK.

33
00:01:55,360 --> 00:01:57,720
So then it will calculate mid.

34
00:01:57,900 --> 00:02:00,080
So Medek was start plus.

35
00:02:00,250 --> 00:02:06,550
And by two now there's zero plus seven by two.

36
00:02:06,820 --> 00:02:08,740
So three point five which is three.

37
00:02:09,280 --> 00:02:09,700
So.

38
00:02:10,790 --> 00:02:12,110
My mate is here.

39
00:02:13,100 --> 00:02:14,630
Now, there are three possibilities.

40
00:02:14,990 --> 00:02:21,410
So first, possibility, number one, if the value present that mid.

41
00:02:22,720 --> 00:02:24,910
Is it close to the given value key?

42
00:02:25,690 --> 00:02:28,500
If this is the case, I will have done made.

43
00:02:29,110 --> 00:02:29,410
OK.

44
00:02:29,920 --> 00:02:33,640
So I found the key and the key is present at the index mid.

45
00:02:34,660 --> 00:02:41,330
Second possibility, if the value add mid is good.

46
00:02:41,440 --> 00:02:42,430
Then that key.

47
00:02:44,190 --> 00:02:52,050
So in this case, for example, it is a greater than four, then I can see that my answer, that key

48
00:02:52,220 --> 00:02:54,490
will lie only in this part.

49
00:02:55,530 --> 00:02:55,860
OK?

50
00:02:56,200 --> 00:02:57,900
He cannot lie here.

51
00:02:58,290 --> 00:03:00,180
So I will discard this part.

52
00:03:01,050 --> 00:03:02,220
So what I will do.

53
00:03:02,400 --> 00:03:05,430
And it was made minus one.

54
00:03:05,700 --> 00:03:07,770
So my end will come here.

55
00:03:09,180 --> 00:03:09,450
OK.

56
00:03:09,750 --> 00:03:11,580
And how can I discard this part?

57
00:03:12,000 --> 00:03:14,460
Because I know this is made.

58
00:03:15,120 --> 00:03:21,510
All these were loose on the left hand side are smaller than mud and all the way loose on the right hand

59
00:03:21,510 --> 00:03:23,280
side are greater than mud.

60
00:03:23,640 --> 00:03:25,760
So these values are less than mid.

61
00:03:26,220 --> 00:03:27,450
And these values are good.

62
00:03:27,550 --> 00:03:29,440
Weird because my is sorted.

63
00:03:29,760 --> 00:03:39,960
So if the value present at mid is greater than key, that means we can only only only lay in the left

64
00:03:39,960 --> 00:03:40,380
part.

65
00:03:41,130 --> 00:03:43,480
So I can discard the right part.

66
00:03:43,740 --> 00:03:44,040
OK.

67
00:03:44,790 --> 00:03:47,790
And similarly, if.

68
00:03:50,240 --> 00:03:53,470
Murder is a less than key then.

69
00:03:53,870 --> 00:03:55,940
So this is my murder.

70
00:03:56,840 --> 00:03:58,460
This is right and this is left.

71
00:03:58,940 --> 00:04:00,750
So right if I lose, Agard then moved.

72
00:04:02,420 --> 00:04:10,940
So if my murder if developers entered Murd is listing key, then my answer will only lie in the right

73
00:04:10,940 --> 00:04:11,330
part.

74
00:04:11,660 --> 00:04:13,130
In that case, I will.

75
00:04:14,520 --> 00:04:16,200
Ignored the left part.

76
00:04:16,650 --> 00:04:17,880
And what I will do?

77
00:04:17,970 --> 00:04:18,570
Start.

78
00:04:18,750 --> 00:04:21,720
It was mid bless when.

79
00:04:21,990 --> 00:04:23,750
So murder will come here.

80
00:04:23,940 --> 00:04:25,680
So restart start will come here.

81
00:04:27,060 --> 00:04:31,170
And my problem is, no, only this I have to search only on this part.

82
00:04:32,550 --> 00:04:37,110
OK, so let's take an example and we will see what happens.

83
00:04:38,880 --> 00:04:39,360
So.

84
00:04:44,740 --> 00:04:49,690
So zero, one, two, three, four, five and six.

85
00:04:50,260 --> 00:04:54,360
And the values are two, five, eight.

86
00:04:55,470 --> 00:04:59,540
13, 15, 20 and 25.

87
00:05:00,480 --> 00:05:02,500
And I want to search for value.

88
00:05:02,730 --> 00:05:05,460
Let's say Geek was search for five.

89
00:05:06,550 --> 00:05:09,780
OK, so first of all, this is a start.

90
00:05:10,110 --> 00:05:11,040
This is my start.

91
00:05:11,490 --> 00:05:12,360
And this is my.

92
00:05:13,030 --> 00:05:15,250
And now I will calculate mid.

93
00:05:15,750 --> 00:05:21,330
So Medek was start, which is zero plus and which is six by two.

94
00:05:21,810 --> 00:05:22,980
So murders three.

95
00:05:23,730 --> 00:05:25,140
Now this is my mid.

96
00:05:26,610 --> 00:05:28,870
So compare the value is 13.

97
00:05:29,640 --> 00:05:30,390
It closed five.

98
00:05:30,450 --> 00:05:32,690
No, no check today.

99
00:05:32,820 --> 00:05:32,950
Good.

100
00:05:33,060 --> 00:05:33,630
Then five.

101
00:05:33,690 --> 00:05:34,020
Yes.

102
00:05:34,050 --> 00:05:35,040
The condition is true.

103
00:05:35,310 --> 00:05:37,410
My answer will lie in the left part.

104
00:05:37,740 --> 00:05:39,060
So I will discard this.

105
00:05:41,310 --> 00:05:44,860
So and it was made minus one.

106
00:05:45,300 --> 00:05:47,720
So that is three minus one, nerdish two.

107
00:05:48,180 --> 00:05:49,230
So this is my end.

108
00:05:50,100 --> 00:05:51,120
This is my end.

109
00:05:53,090 --> 00:06:01,640
Now, I will again calculate mid, so mid equals start, which is zero, and which is two by two.

110
00:06:02,510 --> 00:06:03,850
So it is coming out to be one.

111
00:06:04,160 --> 00:06:05,360
So this is mid.

112
00:06:06,350 --> 00:06:07,820
This is mid.

113
00:06:08,240 --> 00:06:11,730
Now, again, I will compare is five it close to five.

114
00:06:11,990 --> 00:06:12,560
Yes.

115
00:06:13,100 --> 00:06:16,220
Then what I will do, I will return mid.

116
00:06:17,240 --> 00:06:18,020
Return mid.

117
00:06:18,410 --> 00:06:20,330
So I will return in next one.

118
00:06:21,410 --> 00:06:23,750
OK, so this is how binary search look.

119
00:06:25,270 --> 00:06:26,850
Now, in our district, when one example.

120
00:06:30,030 --> 00:06:33,180
So I suppose the adays.

121
00:06:39,910 --> 00:06:44,260
Zero, one, two, three, four, five and six.

122
00:06:44,740 --> 00:06:51,730
And let's say that they lose out one, four, five, ten to an 18 and 25.

123
00:06:52,510 --> 00:06:55,480
And I want to search for, let's say, twenty.

124
00:06:56,430 --> 00:06:56,680
OK.

125
00:06:57,130 --> 00:06:58,910
I want to search for value 25.

126
00:07:00,940 --> 00:07:02,140
So this is my start.

127
00:07:03,010 --> 00:07:04,160
This is my end.

128
00:07:05,600 --> 00:07:12,360
First of all, calculate the mid so medicos start bless and buy two.

129
00:07:12,950 --> 00:07:14,710
So Medical's three.

130
00:07:15,570 --> 00:07:17,450
Okay, so this is my mid.

131
00:07:18,950 --> 00:07:21,750
Now, compare is stand equals 25.

132
00:07:21,800 --> 00:07:22,130
No.

133
00:07:22,940 --> 00:07:25,360
The second condition is stronger than 25.

134
00:07:25,640 --> 00:07:28,160
No less than 25.

135
00:07:28,410 --> 00:07:30,570
I guess a middle value is less than key.

136
00:07:30,950 --> 00:07:34,720
So I will search on the right hand side that is and equals.

137
00:07:35,100 --> 00:07:38,440
So you start equals mid plus one.

138
00:07:38,900 --> 00:07:40,970
So it values three plus one.

139
00:07:41,570 --> 00:07:42,590
So this is four.

140
00:07:42,710 --> 00:07:48,070
So now this is my updated start and I will discard this whole part.

141
00:07:49,400 --> 00:07:54,980
Now, what I will do, I will conclude made again, so I made it because when Leo started this.

142
00:07:55,580 --> 00:07:57,560
And there's six by two.

143
00:07:58,190 --> 00:07:59,840
So Meredith's coming out to five.

144
00:07:59,990 --> 00:08:01,340
So this is my mid.

145
00:08:03,710 --> 00:08:06,890
Now, compare is 18, it goes to 25.

146
00:08:07,030 --> 00:08:07,330
No.

147
00:08:08,440 --> 00:08:09,070
Is 18.

148
00:08:09,170 --> 00:08:09,340
Good.

149
00:08:09,380 --> 00:08:10,310
Then 25.

150
00:08:10,580 --> 00:08:11,030
No.

151
00:08:11,570 --> 00:08:12,260
Is 18.

152
00:08:12,380 --> 00:08:13,520
Less than 25.

153
00:08:13,670 --> 00:08:14,120
Yes.

154
00:08:14,720 --> 00:08:15,620
So what they will do.

155
00:08:15,700 --> 00:08:19,090
Start equals mid plus one.

156
00:08:19,850 --> 00:08:22,460
So murders five plus one.

157
00:08:22,760 --> 00:08:24,440
So start equals six.

158
00:08:24,890 --> 00:08:26,570
So discard the left hand side.

159
00:08:29,230 --> 00:08:32,030
Now, this is my start.

160
00:08:33,410 --> 00:08:33,720
OK.

161
00:08:34,450 --> 00:08:40,790
Now I will calculate made again, so Medical's start, Blur's and by two.

162
00:08:41,410 --> 00:08:43,450
So it is coming out to be six.

163
00:08:43,900 --> 00:08:44,620
Now compare.

164
00:08:45,250 --> 00:08:48,070
So is eight of six.

165
00:08:48,140 --> 00:08:49,270
That is 25.

166
00:08:49,750 --> 00:08:50,980
So is 25.

167
00:08:51,100 --> 00:08:52,240
Equals 25.

168
00:08:52,420 --> 00:08:54,730
Yes, the condition is true.

169
00:08:55,120 --> 00:08:59,380
I will return mid and murders six.

170
00:08:59,440 --> 00:09:04,600
So I will have done six and add the next six available and the five is present.

171
00:09:05,320 --> 00:09:05,600
OK.

172
00:09:06,100 --> 00:09:07,920
So this is out by new search work.

173
00:09:08,500 --> 00:09:12,490
And now let us take one more example where the key will not be found.

174
00:09:13,250 --> 00:09:13,530
OK.

175
00:09:14,110 --> 00:09:15,790
So this is Mary.

176
00:09:23,100 --> 00:09:27,480
Zero, one, two, three, four, five.

177
00:09:28,590 --> 00:09:29,340
And let's see.

178
00:09:29,760 --> 00:09:30,960
Six and seven.

179
00:09:31,740 --> 00:09:33,720
And the values are two.

180
00:09:33,810 --> 00:09:35,280
Three, four.

181
00:09:35,430 --> 00:09:35,880
Eight.

182
00:09:36,190 --> 00:09:36,350
Two.

183
00:09:37,200 --> 00:09:37,920
Fifteen.

184
00:09:37,990 --> 00:09:38,500
Twenty.

185
00:09:38,750 --> 00:09:39,650
Twenty seven.

186
00:09:40,860 --> 00:09:45,120
And the value that I want to search for is, let's say five.

187
00:09:45,540 --> 00:09:47,160
OK, so five is not present here.

188
00:09:47,520 --> 00:09:49,110
I want to search for five.

189
00:09:50,550 --> 00:09:51,820
So this is my start.

190
00:09:52,620 --> 00:09:53,780
This is my end.

191
00:09:54,640 --> 00:09:56,270
Now let's call the valley of the.

192
00:09:56,530 --> 00:09:58,020
Of Medical's start.

193
00:09:58,590 --> 00:10:01,430
Bless and buy two.

194
00:10:02,010 --> 00:10:07,050
So it is coming out to be three point five which is three and point upon integer will be an integer.

195
00:10:07,980 --> 00:10:09,150
So this is my mind.

196
00:10:10,860 --> 00:10:13,440
Now compare it to close five.

197
00:10:13,800 --> 00:10:14,240
No.

198
00:10:15,020 --> 00:10:15,290
Eight.

199
00:10:15,330 --> 00:10:15,510
Good.

200
00:10:15,570 --> 00:10:16,200
Then five.

201
00:10:16,530 --> 00:10:17,100
Yes.

202
00:10:17,340 --> 00:10:18,210
So what I will do.

203
00:10:18,480 --> 00:10:22,850
And it was made minus when that is what is there.

204
00:10:22,940 --> 00:10:23,910
You have made three.

205
00:10:24,210 --> 00:10:25,800
So three minus one.

206
00:10:26,310 --> 00:10:26,490
So.

207
00:10:26,490 --> 00:10:27,420
And equals two.

208
00:10:27,930 --> 00:10:30,170
So this is the new value off end.

209
00:10:31,250 --> 00:10:34,410
And what I will do, I will discard the right hand side.

210
00:10:36,450 --> 00:10:44,510
Now, again, calculate what is the value of mid, which is start bless and buy two.

211
00:10:45,240 --> 00:10:46,740
OK, so two by two is one.

212
00:10:47,220 --> 00:10:48,610
So this is my mid.

213
00:10:49,140 --> 00:10:49,950
This is mid.

214
00:10:51,030 --> 00:10:52,330
Now, compare the value of it.

215
00:10:52,800 --> 00:10:54,780
So is three equals five.

216
00:10:55,080 --> 00:10:55,470
No.

217
00:10:56,040 --> 00:10:56,990
So is three.

218
00:10:57,000 --> 00:10:57,190
Good.

219
00:10:57,240 --> 00:10:57,960
Then five.

220
00:10:58,260 --> 00:10:58,740
No.

221
00:10:59,190 --> 00:10:59,980
So is three.

222
00:11:00,000 --> 00:11:00,900
Less than five.

223
00:11:01,140 --> 00:11:01,560
Yes.

224
00:11:01,830 --> 00:11:02,700
So what I will do.

225
00:11:02,910 --> 00:11:06,840
Start equals mid plus one.

226
00:11:07,440 --> 00:11:09,740
So what is the value of made one.

227
00:11:09,860 --> 00:11:10,830
So one plus one.

228
00:11:11,010 --> 00:11:12,240
The value of start this two.

229
00:11:12,780 --> 00:11:14,940
So start will reach here.

230
00:11:16,680 --> 00:11:21,810
Now again calculate the value of mid which is start plus.

231
00:11:22,050 --> 00:11:26,190
And by doing so four by two is two.

232
00:11:26,520 --> 00:11:27,630
So this is my mid.

233
00:11:28,500 --> 00:11:29,400
This is mid.

234
00:11:30,410 --> 00:11:32,600
Now, what I will do, I will compare the values.

235
00:11:33,320 --> 00:11:36,230
So is four equals five.

236
00:11:36,980 --> 00:11:37,400
No.

237
00:11:38,030 --> 00:11:39,800
Is four greater than five?

238
00:11:40,310 --> 00:11:40,730
No.

239
00:11:41,120 --> 00:11:42,020
So is four.

240
00:11:42,350 --> 00:11:43,250
Less than five.

241
00:11:43,550 --> 00:11:44,000
Yes.

242
00:11:44,330 --> 00:11:45,170
So what I will do.

243
00:11:45,380 --> 00:11:48,770
Start a course made plus one.

244
00:11:49,430 --> 00:11:51,410
So what is there a love made murders.

245
00:11:51,440 --> 00:11:51,700
Two.

246
00:11:51,860 --> 00:11:52,610
Two plus one.

247
00:11:52,970 --> 00:11:53,930
So Star Destry.

248
00:11:54,520 --> 00:11:56,150
So my start will come here.

249
00:11:57,780 --> 00:11:58,920
So this is my start.

250
00:11:59,610 --> 00:12:04,380
Now, what happened is start is three and is two.

251
00:12:06,980 --> 00:12:08,870
This is a start and this is and.

252
00:12:10,210 --> 00:12:14,690
Okay, so what happened here is start becomes greater then.

253
00:12:14,810 --> 00:12:24,650
And so if this is the condition, that means I can say I will stop and I will report that the key is

254
00:12:24,710 --> 00:12:26,480
not present.

255
00:12:27,150 --> 00:12:28,210
Key not found.

256
00:12:28,750 --> 00:12:29,040
OK.

257
00:12:29,330 --> 00:12:38,030
So if my start becomes an end, I will stop and I will report my answer that the given key is not present

258
00:12:38,150 --> 00:12:39,040
in the area.

259
00:12:41,290 --> 00:12:41,510
OK.

260
00:12:42,170 --> 00:12:44,690
So this is how binary search works.

261
00:12:45,820 --> 00:12:50,220
Now they're desperate to find how many number of steps by new search will take.

262
00:12:51,530 --> 00:12:51,820
OK.

263
00:12:52,140 --> 00:12:59,760
So what I am doing, I am calculating the value of limited riches start plus and Bitel and then I'm

264
00:12:59,820 --> 00:13:01,880
comparing mid with key.

265
00:13:02,480 --> 00:13:04,560
I am comparing these two values.

266
00:13:05,220 --> 00:13:11,070
And each time I am comparing these values, what I am doing, I am reducing my number of elements on

267
00:13:11,070 --> 00:13:12,090
which I have to search.

268
00:13:13,050 --> 00:13:13,300
OK.

269
00:13:13,650 --> 00:13:15,960
So if murd is a good denki.

270
00:13:17,440 --> 00:13:19,210
And it was made minus one.

271
00:13:19,570 --> 00:13:21,490
So if there are any elements.

272
00:13:22,030 --> 00:13:23,740
So suppose there are any elements.

273
00:13:25,200 --> 00:13:26,100
This is mid.

274
00:13:27,490 --> 00:13:30,370
And if this mid is good denki, what I did.

275
00:13:30,880 --> 00:13:32,800
I will put my point out here.

276
00:13:33,250 --> 00:13:33,970
Where does it start?

277
00:13:34,000 --> 00:13:34,700
And this is end.

278
00:13:35,050 --> 00:13:37,840
So this is my new search space.

279
00:13:39,070 --> 00:13:43,450
So this is my new search space given only be present here.

280
00:13:43,570 --> 00:13:44,980
Otherwise you will not be there.

281
00:13:45,580 --> 00:13:48,370
So initially I was searching on N elements.

282
00:13:50,320 --> 00:13:53,020
Then I am searching on end by two elements.

283
00:13:55,370 --> 00:13:55,660
OK.

284
00:13:55,980 --> 00:13:58,210
And we will repeat the same process here also.

285
00:13:58,440 --> 00:13:59,470
I will calculate murd.

286
00:13:59,550 --> 00:14:00,630
I will compare key.

287
00:14:01,110 --> 00:14:07,320
And similarly, if it is less dinkie, what I will lose start equals mid plus one.

288
00:14:07,650 --> 00:14:10,950
So start will come here and I will discard this part.

289
00:14:11,580 --> 00:14:14,010
So again, these are and by two elements only.

290
00:14:15,000 --> 00:14:15,790
So what I am doing.

291
00:14:15,900 --> 00:14:19,380
I am decreasing my search space by two.

292
00:14:19,710 --> 00:14:22,230
So next time I will search on and buy four elements.

293
00:14:24,580 --> 00:14:26,950
Then end by eight elements and so on.

294
00:14:27,700 --> 00:14:27,980
OK.

295
00:14:28,330 --> 00:14:35,110
So each time I am reducing my search of space, the search space means the number of elements on which

296
00:14:35,110 --> 00:14:36,010
you have to search.

297
00:14:36,060 --> 00:14:37,570
You have to perform search operation.

298
00:14:38,440 --> 00:14:39,580
So what is happening here?

299
00:14:40,000 --> 00:14:41,440
Initially, I have to search.

300
00:14:43,480 --> 00:14:48,280
In N elements, then I will calculate, made and then compare.

301
00:14:48,610 --> 00:14:51,550
Then I have to search in and buy two elements.

302
00:14:53,170 --> 00:14:55,930
Then I have to search for and buy four elements.

303
00:14:56,110 --> 00:15:01,180
I will search in and buy four elements for the glue and key, and it will keep going on.

304
00:15:02,110 --> 00:15:06,670
Let's see the number of steps in bindings, which is key.

305
00:15:07,320 --> 00:15:07,560
Okay.

306
00:15:07,830 --> 00:15:11,430
Let's say here by new search takes K steps.

307
00:15:11,690 --> 00:15:13,900
My minus such big key steps.

308
00:15:14,410 --> 00:15:17,380
So finally end upon to the power key.

309
00:15:19,230 --> 00:15:26,900
OK, so when this bisnis search will stop, when there is only one element in the area so.

310
00:15:27,130 --> 00:15:34,120
And upon to a close one, that is this business which will stop only when there is only one element

311
00:15:34,120 --> 00:15:34,610
in the area.

312
00:15:35,440 --> 00:15:39,600
Because I cannot divide one element into two 1/2.

313
00:15:40,030 --> 00:15:40,330
OK.

314
00:15:41,200 --> 00:15:45,570
So in a quest to the power K taking log on both desires.

315
00:15:46,120 --> 00:15:52,840
So log in it goes key log two and K equals log.

316
00:15:52,900 --> 00:15:54,280
And with the base two.

317
00:15:54,850 --> 00:15:58,300
And I told you that constant doesn't matters.

318
00:15:58,690 --> 00:16:03,020
So Keiko's log off in constant doesn't Mattos.

319
00:16:03,310 --> 00:16:04,990
So give us the number of steps.

320
00:16:06,270 --> 00:16:14,430
And this is the log and so binary search, binary search takes log off and steps.

321
00:16:16,320 --> 00:16:18,600
So what is the time complexity of binary search?

322
00:16:19,050 --> 00:16:24,390
It is bigger off log in and linear search time.

323
00:16:24,390 --> 00:16:26,610
Complexity of linear search was off.

324
00:16:26,730 --> 00:16:29,640
And so this is for sorted.

325
00:16:30,090 --> 00:16:30,390
Eddie.

326
00:16:33,190 --> 00:16:42,210
OK, so if the given that is sorted, then binary search is a much, much efficient then linear search.

327
00:16:43,110 --> 00:16:45,500
OK, so visited for this video.

328
00:16:45,810 --> 00:16:48,660
And next video, I will write the code for by new search.

329
00:16:49,320 --> 00:16:49,620
OK.

330
00:16:50,160 --> 00:16:51,990
So if you have any doubt, feel free to ask.

331
00:16:52,200 --> 00:16:52,770
Thank you.
