1
00:00:01,730 --> 00:00:03,470
Hey, guys, what's up?

2
00:00:03,800 --> 00:00:06,720
So today I saw one more interesting problem on Eddys.

3
00:00:07,220 --> 00:00:13,800
So the problem is find the largest in L.A..

4
00:00:16,430 --> 00:00:25,430
For example, suppose the number of elements in an ad is Ford and the elements are four to one.

5
00:00:26,060 --> 00:00:26,690
And then.

6
00:00:27,290 --> 00:00:29,470
So what is the largest element then?

7
00:00:29,780 --> 00:00:31,010
So what should be my output?

8
00:00:31,190 --> 00:00:33,560
My output should be the largest.

9
00:00:33,620 --> 00:00:34,630
It was 10.

10
00:00:35,180 --> 00:00:37,580
So we have to find the largest element in league.

11
00:00:37,760 --> 00:00:40,580
Eddie, suppose the number of elements are.

12
00:00:41,810 --> 00:00:44,510
Five and the elements are, let's say, seven,

13
00:00:49,010 --> 00:00:53,480
seven, two, four, one and nine.

14
00:00:54,080 --> 00:00:58,790
So virtually my output, Marbut should be nine because nine is the largest element.

15
00:00:59,260 --> 00:00:59,550
OK.

16
00:01:00,170 --> 00:01:04,620
So is the problem clear that we have to find the largest element in the Eddie?

17
00:01:05,850 --> 00:01:07,110
So what we have to do first.

18
00:01:08,040 --> 00:01:09,400
First of all, water they can put.

19
00:01:09,510 --> 00:01:17,320
So CNN and a number of elements, then I will either do at it and I will take and put seen a fight now

20
00:01:17,330 --> 00:01:18,480
and put is ready.

21
00:01:19,210 --> 00:01:22,290
So first of all, we will do it.

22
00:01:22,580 --> 00:01:25,500
And and then a number of elements.

23
00:01:26,940 --> 00:01:28,780
Now big elements as input.

24
00:01:28,890 --> 00:01:33,170
So it goes to zero my list and then I bless bliss.

25
00:01:34,000 --> 00:01:35,840
See in a fight.

26
00:01:37,320 --> 00:01:40,020
Now at this point of time our Ed it will be ready.

27
00:01:40,110 --> 00:01:42,780
Now what we have to do, we have to find the largest element.

28
00:01:43,470 --> 00:01:44,940
So we are finding the largest element.

29
00:01:45,000 --> 00:01:51,950
What do you suppose that is, let's say and equals four number of elements out of food and values out.

30
00:01:52,080 --> 00:01:54,900
Five, one, nine and two.

31
00:01:56,250 --> 00:01:57,420
So these are my values.

32
00:02:00,690 --> 00:02:01,940
So the idea is very simple.

33
00:02:02,630 --> 00:02:05,730
What I want to do, I will take a variable largest.

34
00:02:07,010 --> 00:02:08,460
I will decorate it the largest.

35
00:02:09,000 --> 00:02:12,680
And I really only slice it with minimum.

36
00:02:16,070 --> 00:02:16,270
OK.

37
00:02:16,710 --> 00:02:17,970
So I will take a variable.

38
00:02:17,970 --> 00:02:21,990
Largest and largest is initially into minimum and minimum.

39
00:02:21,990 --> 00:02:23,340
You can say minus infinity.

40
00:02:23,760 --> 00:02:24,060
OK.

41
00:02:24,810 --> 00:02:27,780
For understanding you can say the minimum is minus infinity.

42
00:02:29,360 --> 00:02:34,160
I have a very largest which is initialised or two minus infinity.

43
00:02:35,840 --> 00:02:37,460
Now, what I will do, I will.

44
00:02:37,520 --> 00:02:38,630
I agree or disagree.

45
00:02:39,560 --> 00:02:41,090
So I will take Ovadia, will I?

46
00:02:41,150 --> 00:02:41,660
And I will.

47
00:02:41,690 --> 00:02:42,170
I did.

48
00:02:43,820 --> 00:02:49,190
So each time what I will do, I will compare the current value with the largest.

49
00:02:49,790 --> 00:02:50,480
So if.

50
00:02:52,210 --> 00:02:53,100
The current value.

51
00:02:53,190 --> 00:02:56,180
That is if fight the current value.

52
00:02:56,820 --> 00:03:00,000
If a fight is greater than my largest value.

53
00:03:01,200 --> 00:03:07,190
If a towfigh is good, then my largest value, then I will update my largest value.

54
00:03:07,520 --> 00:03:09,690
So logistic was a fight.

55
00:03:12,090 --> 00:03:14,010
OK, so this will be our logic.

56
00:03:14,700 --> 00:03:15,810
If the current value.

57
00:03:17,360 --> 00:03:22,580
If the current value is good, then our largest value, then we will update our largest value.

58
00:03:23,000 --> 00:03:30,320
And that is the reason I initialized my largest with minus infinity so that the first value will be

59
00:03:30,320 --> 00:03:33,960
greater than the largest value and largest get updated.

60
00:03:36,390 --> 00:03:36,710
OK.

61
00:03:38,240 --> 00:03:39,200
So how it will work?

62
00:03:40,400 --> 00:03:43,180
So first of all, I will compare largest with five.

63
00:03:43,790 --> 00:03:44,770
So is five for good.

64
00:03:44,840 --> 00:03:45,920
Then minus infinity.

65
00:03:46,010 --> 00:03:47,180
Yes, the condition is true.

66
00:03:47,750 --> 00:03:51,410
My largest really becoming close to five.

67
00:03:52,100 --> 00:03:53,000
Now I will come here.

68
00:03:53,570 --> 00:03:54,560
Now I will compare.

69
00:03:54,650 --> 00:03:56,520
Is one good then my largest.

70
00:03:56,720 --> 00:03:58,900
You know, the condition is false.

71
00:03:59,000 --> 00:03:59,840
Don't do anything.

72
00:04:00,590 --> 00:04:01,610
Now I will come here.

73
00:04:02,070 --> 00:04:02,780
So I will check.

74
00:04:03,380 --> 00:04:06,230
Is my value greater than my largest value?

75
00:04:06,350 --> 00:04:07,490
Yes, the condition is true.

76
00:04:08,270 --> 00:04:11,380
We will update our largest delusive largest becomes mine.

77
00:04:12,170 --> 00:04:13,190
Then we will come here.

78
00:04:13,680 --> 00:04:14,390
So I will check.

79
00:04:14,960 --> 00:04:15,980
Is too good.

80
00:04:16,010 --> 00:04:16,990
Then my largest.

81
00:04:17,050 --> 00:04:18,610
Really, you know the condition is false.

82
00:04:18,680 --> 00:04:19,490
Don't do anything.

83
00:04:19,970 --> 00:04:26,480
And finally I will print out largest which is containing nine.

84
00:04:28,030 --> 00:04:31,900
OK, so the logic was the logic and problem both had it easy.

85
00:04:32,650 --> 00:04:34,000
So let us test our program.

86
00:04:34,130 --> 00:04:35,230
That's right, our program.

87
00:04:36,460 --> 00:04:37,960
So suppose I named.

88
00:04:40,210 --> 00:04:40,960
Largest.

89
00:04:44,410 --> 00:04:48,250
Largest of any.

90
00:05:04,360 --> 00:05:07,130
Now, what we have to do is, first of all, we will take input.

91
00:05:07,870 --> 00:05:10,620
So end an end to the number of elements.

92
00:05:11,680 --> 00:05:23,590
And now let us take so first of all, it does make an eddy of size and so and a of and just taken so

93
00:05:23,590 --> 00:05:24,530
I equals zero.

94
00:05:24,770 --> 00:05:29,350
I list an end I plus plus scene.

95
00:05:29,860 --> 00:05:33,040
If I now I'd add is ready.

96
00:05:33,130 --> 00:05:43,210
So what we have decided we will take a variable largest which is initially into minimum, it is minus

97
00:05:43,210 --> 00:05:43,870
infinity.

98
00:05:44,260 --> 00:05:51,110
Then what I will do, I will compare this largest value with all the elements and deti so that as I

99
00:05:51,110 --> 00:05:57,430
did or the idea again so indite equal to zero I less than an I plus plus.

100
00:05:58,390 --> 00:06:05,170
So now I will check if the current value is greater than my largest trading.

101
00:06:05,560 --> 00:06:13,090
So if the current value is greater than my largest value, then I will update my largest value.

102
00:06:13,130 --> 00:06:14,110
Two largest equals.

103
00:06:15,490 --> 00:06:18,400
Largest equals if I.

104
00:06:19,010 --> 00:06:19,230
OK.

105
00:06:19,330 --> 00:06:25,740
So if the current value is greater than my largest value then I will update my largest value.

106
00:06:26,080 --> 00:06:26,590
Simple.

107
00:06:29,170 --> 00:06:36,590
And finally, when this lovely terminate, I will have my answer stored in the variable largest Soucy

108
00:06:36,640 --> 00:06:38,770
out largest.

109
00:06:42,970 --> 00:06:45,000
OK, so this is all that we have to do.

110
00:06:48,190 --> 00:06:49,290
So there doesn't know I'm.

111
00:06:52,260 --> 00:06:53,900
So hash included.

112
00:06:59,900 --> 00:07:00,710
Oh, so what?

113
00:07:00,870 --> 00:07:04,040
What we did was we haven't made the final.

114
00:07:05,510 --> 00:07:08,250
Added God to see we have two murdered NCP.

115
00:07:09,200 --> 00:07:10,490
So I'm creating a new file.

116
00:07:15,160 --> 00:07:15,850
Largest.

117
00:07:18,850 --> 00:07:23,060
Of Eddie Dhada CBB.

118
00:07:24,890 --> 00:07:25,080
OK.

119
00:07:25,150 --> 00:07:28,420
So here I find that we have created the extension is Darcy.

120
00:07:28,480 --> 00:07:33,820
Darcy means it is a sequel but in Seek or there isn't a thing called IO stream.

121
00:07:34,540 --> 00:07:38,410
It is, I think S2, DSU, something like that.

122
00:07:39,220 --> 00:07:40,060
OK, so what do you do.

123
00:07:40,070 --> 00:07:42,160
I will copy and paste this whole Cordier.

124
00:07:46,160 --> 00:07:47,490
Now, your distaste I vote on.

125
00:07:49,810 --> 00:07:54,460
So naturally, a number of elements are three and the values are one, two and three.

126
00:07:54,780 --> 00:07:59,560
So to use the largest number you can print here is two out.

127
00:08:06,180 --> 00:08:09,930
See, our largest value equals.

128
00:08:13,490 --> 00:08:15,210
Now let us run it, I mean.

129
00:08:16,790 --> 00:08:24,690
Number of elements, ar3 and elements are one, two and three, so large Australia Post three letter

130
00:08:24,690 --> 00:08:29,400
number of elements are five and the values are three, six to one and four.

131
00:08:30,350 --> 00:08:32,280
So largest value is six.

132
00:08:32,800 --> 00:08:33,120
OK.

133
00:08:34,710 --> 00:08:37,350
No, what if we have to find the smallest element?

134
00:08:39,120 --> 00:08:41,830
So we have to find the smallest element.

135
00:08:44,610 --> 00:08:46,000
So everything will do him.

136
00:08:46,260 --> 00:08:46,950
What I really do.

137
00:08:47,310 --> 00:08:49,590
I didn't make a variable and smallest.

138
00:08:50,520 --> 00:08:52,910
And I will initialize it to intermix.

139
00:08:54,420 --> 00:09:01,500
I will initialize smallest would intermix, which is plus infinity for understanding purpose.

140
00:09:02,460 --> 00:09:03,130
Now I will.

141
00:09:03,270 --> 00:09:04,880
I did what the eddy.

142
00:09:05,730 --> 00:09:07,810
And when I am doing what I will do.

143
00:09:07,860 --> 00:09:11,930
I will check if the current value is good to them.

144
00:09:12,020 --> 00:09:16,200
Sorry if the current value is less than my smallest value.

145
00:09:17,460 --> 00:09:18,090
Then write down.

146
00:09:18,090 --> 00:09:21,630
What I do is I will update my smallest value.

147
00:09:23,690 --> 00:09:23,940
OK.

148
00:09:24,480 --> 00:09:26,130
So logic is very similar.

149
00:09:28,080 --> 00:09:28,500
So.

150
00:09:35,230 --> 00:09:37,280
OK, so let's update discordantly.

151
00:09:38,210 --> 00:09:48,320
So I am taking a small list of any one small list, which is a quiz to Intermix and Angeles, my list

152
00:09:48,320 --> 00:09:49,970
is a quiz took place in Verdie.

153
00:09:51,560 --> 00:09:59,390
Now, I will check if the current value is less than my smallest value.

154
00:10:00,350 --> 00:10:05,500
If the current value is less than my small Australia, what I will do, I will update my small list.

155
00:10:05,500 --> 00:10:05,860
Really.

156
00:10:08,570 --> 00:10:12,860
And similarly, we will print out the

157
00:10:15,830 --> 00:10:16,580
smallest

158
00:10:19,220 --> 00:10:20,330
value equals.

159
00:10:25,000 --> 00:10:28,290
And then so they're distressed at the one.

160
00:10:30,550 --> 00:10:37,150
So in the metaphor, elements out of five and the elements are six to one, five and four.

161
00:10:38,200 --> 00:10:42,160
So the largest Ray Lewis six and the smallest Ray Lewis one.

162
00:10:43,190 --> 00:10:44,300
There's a one more time.

163
00:10:47,160 --> 00:10:48,850
Later in the middle of elements are.

164
00:10:50,950 --> 00:10:53,820
And values are 70.

165
00:10:54,320 --> 00:10:57,690
Twenty five and 10.

166
00:10:59,050 --> 00:11:02,860
So my my district is 70 and my smallest value is 10.

167
00:11:04,390 --> 00:11:08,140
So one change there you can do here is where you can also ride.

168
00:11:09,430 --> 00:11:13,880
So I am initializing my largest value from minus infinity where you can see.

169
00:11:14,320 --> 00:11:15,370
You can also say this.

170
00:11:16,000 --> 00:11:21,060
Suppose my largest value is Defoe's to value of the 80.

171
00:11:22,480 --> 00:11:23,740
We can also write like this.

172
00:11:24,430 --> 00:11:30,740
So what I'm doing here is I am initializing my largest value to the fullest value of DNA.

173
00:11:32,170 --> 00:11:36,070
And if this is the case, then I will start competing from one.

174
00:11:37,480 --> 00:11:37,730
OK.

175
00:11:38,030 --> 00:11:43,510
And if this is the case, I will start competing from one because I am assuming that my foster lose

176
00:11:43,510 --> 00:11:47,620
the smallest value even if he will start competing from zero.

177
00:11:47,710 --> 00:11:53,080
So they will not win a defense because in that case I would start from zero eight four zero will be

178
00:11:53,080 --> 00:11:56,230
compared with the largest and largest as initially IL zero.

179
00:11:56,470 --> 00:12:00,400
So this condition will be false and there will be no there will be no changes.

180
00:12:01,780 --> 00:12:03,490
And similarly, you can also write.

181
00:12:06,120 --> 00:12:08,350
You're so right and

182
00:12:11,790 --> 00:12:12,480
smallest.

183
00:12:13,120 --> 00:12:16,630
I am assuming that my first value is the smallest value in the ATF.

184
00:12:17,170 --> 00:12:22,880
And if this is the case, what I would do, I will start competing funding first, will you?

185
00:12:26,740 --> 00:12:32,640
To a number of elements are five and the elements are when they will tell you four and five, says Mollet.

186
00:12:32,830 --> 00:12:35,010
Now the smallest is one of the largest is five.

187
00:12:35,050 --> 00:12:36,940
They will not be any changes, okay.

188
00:12:37,750 --> 00:12:40,570
They will touch them, even if you will make it zero.

189
00:12:41,110 --> 00:12:43,150
Then I will say they will be no changes.

190
00:12:43,420 --> 00:12:44,580
Our output will be correct.

191
00:12:45,870 --> 00:12:51,580
Little elements are three and elements are two, five and four, so large Israeli is five and the smallest

192
00:12:51,620 --> 00:12:52,500
or lose four.

193
00:12:54,130 --> 00:12:56,470
Okay, so you can visualize it.

194
00:12:56,820 --> 00:13:01,750
Either with the first element of the Eddie or you can initialize it would and the minimum or in the

195
00:13:01,770 --> 00:13:03,920
max you add choise.

196
00:13:05,160 --> 00:13:05,490
OK.

197
00:13:07,030 --> 00:13:08,290
So this is it for this video.

198
00:13:08,320 --> 00:13:08,980
Thank you.
