1
00:00:01,720 --> 00:00:02,290
Hi everyone.

2
00:00:02,290 --> 00:00:06,280
So in this video we will discuss how to it is actually stalled.

3
00:00:06,280 --> 00:00:11,080
So for example if it will create a windy area let's say 5 The size is 5.

4
00:00:11,080 --> 00:00:12,300
So what would happen.

5
00:00:12,310 --> 00:00:17,620
So basically you will get five blocks of memory five blocks of continuous memory and the sites would

6
00:00:17,620 --> 00:00:19,160
be drawing debates.

7
00:00:20,680 --> 00:00:22,870
And let's say if you want to take in both.

8
00:00:22,870 --> 00:00:28,540
So what you will do you will create a variable end and you will dig the value off and from the user

9
00:00:28,630 --> 00:00:30,410
and let's see the value of honesty.

10
00:00:30,490 --> 00:00:31,630
So the value find this tree.

11
00:00:31,630 --> 00:00:36,110
I will use the first three blocks and these two blocks are not used.

12
00:00:36,230 --> 00:00:38,800
Now similarly let us consider to the idea.

13
00:00:38,950 --> 00:00:43,600
For example if you create a judiciary let's say the number of rules out of five and the number of columns

14
00:00:43,600 --> 00:00:44,810
that are also five.

15
00:00:44,830 --> 00:00:45,920
So what will happen.

16
00:00:46,120 --> 00:00:51,710
You will get five fruits and five columns.

17
00:00:51,760 --> 00:00:54,610
So first or second or third row fourth and fifth row.

18
00:00:54,880 --> 00:00:59,070
Similarly first column second column third column fourth and fifth column.

19
00:00:59,110 --> 00:01:01,000
And now let's see what I will take.

20
00:01:01,000 --> 00:01:05,110
So I will take the value of rows and columns input from the user.

21
00:01:05,170 --> 00:01:10,780
So I am going to create the variable and meaning and lose it will give me the value of M which is the

22
00:01:10,780 --> 00:01:13,630
number of rows and end which is the number of columns.

23
00:01:13,630 --> 00:01:17,530
Let's say the value of M is three and the value of these two.

24
00:01:17,530 --> 00:01:19,270
So what I will do I will take.

25
00:01:19,270 --> 00:01:23,980
So I will make use of three rows and only two columns.

26
00:01:24,040 --> 00:01:27,700
So only this much part of the truly array will be used.

27
00:01:27,700 --> 00:01:28,720
So just like this one.

28
00:01:28,750 --> 00:01:30,730
So in this case I am losing three blocks.

29
00:01:30,940 --> 00:01:37,020
And in this case I am losing only these three three rows and two columns.

30
00:01:37,080 --> 00:01:45,280
So this is not actually how my two areas are stored so there are two ways of storing my to the 80.

31
00:01:45,310 --> 00:01:54,060
So first one is actually your major and the second one is actually column major so column

32
00:01:57,180 --> 00:01:58,490
column Major.

33
00:01:58,500 --> 00:02:08,810
And what is their difference so let's say this is one two three four five and then six seven eight nine

34
00:02:08,810 --> 00:02:09,500
and ten.

35
00:02:09,680 --> 00:02:14,830
So it will be 15 then 20 and then here you will have 25.

36
00:02:14,870 --> 00:02:17,560
So in the room we did form.

37
00:02:17,900 --> 00:02:19,400
So what I will do.

38
00:02:19,400 --> 00:02:21,440
So this ad is actually five cross five.

39
00:02:21,770 --> 00:02:25,170
So first thing is same between column major and all major.

40
00:02:25,370 --> 00:02:26,080
What you will have.

41
00:02:26,090 --> 00:02:29,710
You will have one DST basically.

42
00:02:29,720 --> 00:02:33,340
This is you are one damage Larry and its size will be five to five.

43
00:02:33,350 --> 00:02:36,580
That is there will be total 25 elements.

44
00:02:36,620 --> 00:02:38,480
So the first index is going to be 0.

45
00:02:38,810 --> 00:02:44,120
And the last index is going to be 25 24 because there are 25 blocks.

46
00:02:44,120 --> 00:02:46,390
So the last 16 is going to be 24.

47
00:02:46,440 --> 00:02:47,930
I am a bleeding myself.

48
00:02:47,930 --> 00:02:52,520
So this matrix is actually 5 close five and how this is actually stored.

49
00:02:52,550 --> 00:02:59,550
So the first step is same for the major or the column Major what is happening inside the memory.

50
00:02:59,560 --> 00:03:05,850
You will get a one degree you will get a continuous block of memory 25 blocks of continuous memory first

51
00:03:05,860 --> 00:03:10,300
your next is obviously 0 and the last Unix is obviously 24 now.

52
00:03:10,300 --> 00:03:11,700
Indeed all major forms so.

53
00:03:11,930 --> 00:03:13,530
So this is.

54
00:03:13,530 --> 00:03:21,660
So this is let's say for row major and now this is column Major again the size of the array will be

55
00:03:21,660 --> 00:03:21,900
same.

56
00:03:21,930 --> 00:03:26,060
This is your zero index and this is your index 24.

57
00:03:26,220 --> 00:03:28,820
So this is your column Major.

58
00:03:28,910 --> 00:03:29,680
Now what will happen.

59
00:03:29,690 --> 00:03:34,290
So indeed what data from what I will do so I will store the first row.

60
00:03:34,310 --> 00:03:38,680
So this will be one two three four and five.

61
00:03:38,680 --> 00:03:43,870
Then I was told the second row then I was to the third row then I was told the fourth.

62
00:03:43,880 --> 00:03:45,660
And finally I restore the fifth row.

63
00:03:45,710 --> 00:03:50,390
So this will be 25 then 24 then 23 and so on.

64
00:03:50,390 --> 00:03:54,700
Similarly this will be six then seven and so on.

65
00:03:54,710 --> 00:03:56,420
So this is all Major.

66
00:03:56,420 --> 00:03:58,680
We are starting revise.

67
00:03:59,150 --> 00:04:01,160
So we are storing railways first.

68
00:04:01,220 --> 00:04:09,830
I am storing the first row then stored the second row then stored the third row then stored the fourth

69
00:04:09,840 --> 00:04:12,660
row and then stored the fifth through.

70
00:04:12,660 --> 00:04:16,550
So this is how we rule major books and read this column Major.

71
00:04:16,560 --> 00:04:22,100
You can guess first stored the first column then stored the second column.

72
00:04:22,100 --> 00:04:24,590
So first let us draw the first column.

73
00:04:24,590 --> 00:04:31,780
So this will be one then it will be six then it will be eleven then it will be basically 16 and so on.

74
00:04:31,820 --> 00:04:38,860
So first stole the first column then stored the second column then stored the third column.

75
00:04:38,880 --> 00:04:40,170
So this was first.

76
00:04:40,170 --> 00:04:42,600
This column will be stored then this column.

77
00:04:42,600 --> 00:04:47,180
So first this column will be stored then this column will be stored then this column then this column

78
00:04:47,190 --> 00:04:48,600
and finally this column.

79
00:04:48,600 --> 00:04:58,450
So the last five elements will be 25 then 20 then 15 then 10 and then five.

80
00:04:58,470 --> 00:05:00,690
I hope you understood both.

81
00:05:00,720 --> 00:05:07,410
So rule Major is stored rule by rule store the first rule then store the second rule then third then

82
00:05:07,410 --> 00:05:10,310
fold then fifth and so on and then column Major.

83
00:05:10,350 --> 00:05:16,540
I am going to store column by column so first store the first column then you will store the second

84
00:05:16,540 --> 00:05:20,590
column then you install the third column then you will store the fourth column and so on.

85
00:05:20,590 --> 00:05:24,610
Now among these two major is actually the correct one.

86
00:05:24,670 --> 00:05:27,000
So we use this rule Major.

87
00:05:27,010 --> 00:05:27,940
I am repeating myself.

88
00:05:28,540 --> 00:05:31,240
So this is how we visualize our judiciary.

89
00:05:31,510 --> 00:05:34,060
So this is only for visualization.

90
00:05:34,090 --> 00:05:39,910
Now inside the memory inside our system this truly metrics is actually stored as a one dimensional area

91
00:05:40,870 --> 00:05:42,890
and to store this one dimension Larry.

92
00:05:42,970 --> 00:05:44,560
Basically there are two approaches.

93
00:05:44,560 --> 00:05:46,500
First is the major approach.

94
00:05:46,510 --> 00:05:48,700
Second is the column measured approach.

95
00:05:48,700 --> 00:05:52,120
So among these two approaches draw major approach is used.

96
00:05:52,630 --> 00:05:56,870
So we are going to use that all major approach and column major approach is not used.

97
00:05:56,950 --> 00:05:58,860
It is very rarely used.

98
00:05:58,930 --> 00:06:03,970
All the systems in today's world uses rule major approach.

99
00:06:03,970 --> 00:06:10,390
Now in the room your approach let's see how it will work so for example if you want to store something

100
00:06:11,260 --> 00:06:21,900
let's say my area is a again five rules five columns so you will get five rows and you will get five

101
00:06:21,900 --> 00:06:22,380
columns.

102
00:06:22,380 --> 00:06:23,040
Correct.

103
00:06:23,040 --> 00:06:23,890
So the first rule.

104
00:06:23,910 --> 00:06:27,860
Second row third row and fourth and fifth rule similarly first column.

105
00:06:27,930 --> 00:06:30,500
Second column third column fourth and fifth column.

106
00:06:30,510 --> 00:06:35,960
And now let's say you want to do something like this go to second row.

107
00:06:36,050 --> 00:06:38,750
You want to do a of to 1 equals 7.

108
00:06:38,870 --> 00:06:44,090
So this is 0 1 2 3 and 4 this is 0 1 2 3 and 4.

109
00:06:44,720 --> 00:06:50,150
Now we are going to visualize it like this but actually it will be stored as a one day area so if 2

110
00:06:50,200 --> 00:06:52,010
1 So this is 2 and 1.

111
00:06:52,010 --> 00:06:56,090
So here I will store 7 for regulation.

112
00:06:56,090 --> 00:07:00,480
This is correct but how it will actually be getting stored.

113
00:07:00,530 --> 00:07:06,880
So basically again you will have one day at a and we are actually going to store in the true Major form.

114
00:07:06,890 --> 00:07:11,230
So this is indexed as you do this is in next 24.

115
00:07:11,230 --> 00:07:13,730
Now I want to store this element 7.

116
00:07:13,760 --> 00:07:20,560
So what we have to do we have to find the index so basically you have to convert the politician to come

117
00:07:20,560 --> 00:07:22,780
on into the one D.

118
00:07:22,990 --> 00:07:31,080
So this is one B area so you have to find the correct index is starting to call Milan and how we can

119
00:07:31,080 --> 00:07:33,410
find that correct index.

120
00:07:33,450 --> 00:07:35,100
So basically let's see.

121
00:07:35,100 --> 00:07:37,320
So this has to come out when.

122
00:07:37,440 --> 00:07:41,820
So what we have to do so we have to skip first row then we have to skip second row.

123
00:07:41,820 --> 00:07:42,740
So how many cells.

124
00:07:42,750 --> 00:07:46,170
One two three four five six seven eight nine ten.

125
00:07:46,200 --> 00:07:48,830
So how many cells we have to skip.

126
00:07:48,840 --> 00:07:50,960
So first of all the value of.

127
00:07:51,780 --> 00:07:53,740
So this is actually true.

128
00:07:53,790 --> 00:07:56,860
So you have to skip Tutu's.

129
00:07:57,170 --> 00:07:58,990
So this is first rule that you have to skip.

130
00:07:59,000 --> 00:08:03,170
This is the second rule you that you have to skip and then you have to skip one column.

131
00:08:03,710 --> 00:08:09,950
So two rows plus one column and how many elements how many cells are present in doodles.

132
00:08:09,980 --> 00:08:13,280
So in Vendrell there are five elements.

133
00:08:13,280 --> 00:08:14,290
Five cents.

134
00:08:14,340 --> 00:08:16,280
So two into five plus one.

135
00:08:16,280 --> 00:08:23,530
So basically we have to skip 11 cents we have to skip 11 cents and we have to insert our element and

136
00:08:23,530 --> 00:08:25,290
do well to sell.

137
00:08:25,290 --> 00:08:37,980
So we will we will insert seven inside twelve to sell now not Wilson will be present at the next eleven.

138
00:08:38,170 --> 00:08:41,320
So add to next 11 because the indexing starts from zero.

139
00:08:41,380 --> 00:08:49,340
So that Wilson is actually next eleven in one dimension Larry so you store seven at index eleven of

140
00:08:49,380 --> 00:08:52,930
this so actually what happens.

141
00:08:52,930 --> 00:08:54,720
So this calculation.

142
00:08:55,030 --> 00:08:59,800
So this calculation we will not do this calculation and this calculation is actually automatically done

143
00:08:59,800 --> 00:09:08,070
by our system so internally our duty edit internally our duty area is actually going to be stored in

144
00:09:08,070 --> 00:09:14,910
the room we dare form basically in the one dimension Larry and this calculation the calculation of finding

145
00:09:14,910 --> 00:09:16,340
the correct index.

146
00:09:16,380 --> 00:09:22,750
So this is going to be done by our system automatically can we generate the formula.

147
00:09:23,230 --> 00:09:28,360
So for example I want to insert that I Yeltsin and the G8 column.

148
00:09:29,350 --> 00:09:31,210
So what is what will be our formula.

149
00:09:31,240 --> 00:09:43,630
So here we can see if the value of so this is actually a and this is actually G so so we have to insert

150
00:09:43,640 --> 00:09:50,240
at index eleven so for finding the eleven what you did you multiply two what to two is I.

151
00:09:50,270 --> 00:09:54,980
So you will multiply with how many cells are present in.

152
00:09:54,980 --> 00:09:55,810
Wonderful.

153
00:09:56,030 --> 00:10:00,170
So five other cells present in bundle basically these are the columns.

154
00:10:00,170 --> 00:10:03,530
So these are the columns and what of the value of columns so let's see.

155
00:10:03,530 --> 00:10:08,910
So are denotes rose and c denote column.

156
00:10:09,300 --> 00:10:16,340
So I am a diplomacy and then basically this plus one is actually the value of G so you relate.

157
00:10:16,350 --> 00:10:18,240
Plus G.

158
00:10:18,340 --> 00:10:21,850
So this is the formula for calculating the index

159
00:10:25,480 --> 00:10:27,710
so just let us take an example.

160
00:10:27,760 --> 00:10:40,730
So let's say you want to insert at of three called Michael so according to this one AFTRA do so this

161
00:10:40,730 --> 00:10:43,220
is three and this is two.

162
00:10:43,240 --> 00:10:46,370
So let's say you want to insert element eight.

163
00:10:46,390 --> 00:10:47,500
Now let us use this formula.

164
00:10:47,530 --> 00:10:49,270
So the value of pi is 2.

165
00:10:49,270 --> 00:10:50,770
So this is your eye.

166
00:10:51,160 --> 00:10:53,030
And this is your G.

167
00:10:53,200 --> 00:10:55,350
So 3 multiply how many columns are there.

168
00:10:55,360 --> 00:10:58,180
So you can see there are five columns.

169
00:10:58,180 --> 00:11:03,910
So that's why I told you the value of column is mandatory rules are not mandatory because in the formula

170
00:11:03,940 --> 00:11:07,430
column will be getting column is getting used not rows.

171
00:11:07,480 --> 00:11:09,820
So there are five columns.

172
00:11:09,820 --> 00:11:11,230
And what is the value of j.

173
00:11:11,230 --> 00:11:14,200
So the value of j is too so according to this formula you should.

174
00:11:14,200 --> 00:11:19,950
In so doing element so three into 515 plus two you should insert your element at index 17.

175
00:11:20,140 --> 00:11:22,270
So let's say this is your index and 17.

176
00:11:22,270 --> 00:11:25,330
And here you will store the element eight.

177
00:11:25,330 --> 00:11:28,720
Now let's see with that our output is whether this formula is correct or wrong.

178
00:11:29,260 --> 00:11:34,900
So skip one two three four five six seven eight nine ten eleven.

179
00:11:34,930 --> 00:11:39,670
This is drill 13 14 15 16 17 and 18.

180
00:11:39,670 --> 00:11:42,400
So basically you have to skip 17 cents.

181
00:11:42,520 --> 00:11:49,180
So how I mean since we have to skip we have to skip 17 since that means I want to insert at 18 to sell

182
00:11:50,280 --> 00:11:51,800
and in the 80.

183
00:11:51,870 --> 00:11:53,650
The indexing starts from zero.

184
00:11:53,700 --> 00:11:57,200
So 18 to sell means the index is going to be 17.

185
00:11:57,210 --> 00:12:03,800
So this is the formula and you have to remember this formula so finally.

186
00:12:03,830 --> 00:12:12,810
So finally this is I am writing that is n for you if you are creating an eddy the number of rows I'd

187
00:12:12,830 --> 00:12:15,300
add the number of columns to see.

188
00:12:15,440 --> 00:12:20,030
So in the middle throws out in ordered by capital letter at a number of columns and in order to make

189
00:12:20,040 --> 00:12:21,900
capital letters c.

190
00:12:22,150 --> 00:12:28,990
And if you want to insert if you want to excess yet row and git column.

191
00:12:28,990 --> 00:12:34,030
So the formula for finding the correct index is actually a minus.

192
00:12:34,240 --> 00:12:49,460
I multiply so this is I multiply C plus G.

193
00:12:49,670 --> 00:12:53,720
This is draw major.

194
00:12:53,810 --> 00:12:59,830
So what is the form logging out is the number of rows sees the number of columns you want to access.

195
00:12:59,880 --> 00:13:03,080
I get rule jeered column l I.

196
00:13:03,110 --> 00:13:10,610
So this is nothing this is just I will get multiplied with these columns this value and you will add

197
00:13:10,610 --> 00:13:13,430
plus G.

198
00:13:13,480 --> 00:13:19,030
So this is for real major and all the computers uses rule Major.

199
00:13:19,030 --> 00:13:24,570
So if you want to find out the formula for column Major what do you do you will just write the opposite.

200
00:13:24,760 --> 00:13:28,550
Basically interchange identity and invent change.

201
00:13:28,570 --> 00:13:29,550
I N G.

202
00:13:29,780 --> 00:13:33,000
Simple just everything will become oppose.

203
00:13:33,550 --> 00:13:36,040
So it all major is not important.

204
00:13:36,040 --> 00:13:39,280
Our system stored the data in a true Major form.

205
00:13:39,280 --> 00:13:41,410
So that's why this formula is important.

206
00:13:41,740 --> 00:13:47,520
And that's why I told you the value of column is mandatory via value of column is mandatory.

207
00:13:47,530 --> 00:13:52,540
So even if you will not give the value offered so you are not giving the value of our let's say Vanuatu

208
00:13:52,560 --> 00:13:55,680
initializing the eddy you are not giving the value offered.

209
00:13:55,780 --> 00:13:59,680
Now in order to access a neutral and yet column What do you need.

210
00:13:59,680 --> 00:14:05,050
You need only the value of c you can see in this formula is not used.

211
00:14:05,320 --> 00:14:07,910
You only need the value of c.

212
00:14:08,170 --> 00:14:10,880
So that's why the value of C is mandatory.

213
00:14:10,990 --> 00:14:15,750
You have to give value of C so that so that system can use this formula.

214
00:14:15,790 --> 00:14:17,740
So that's why the value is important.

215
00:14:17,740 --> 00:14:19,240
That's why C is mandatory.

216
00:14:19,300 --> 00:14:23,740
And similarly so you can see here what we are doing.

217
00:14:23,740 --> 00:14:27,510
So let's say we do not initialize the 80

218
00:14:31,520 --> 00:14:41,820
so let's say I'm creating an so this is let's say the golem ended ended.

219
00:14:41,930 --> 00:15:00,170
The rules are 5 5 rules and and let us stick in input from the use it only.

220
00:15:00,340 --> 00:15:08,780
So what we are doing here and now let us call Brent at a function.

221
00:15:08,970 --> 00:15:14,570
Now if you remember I told you that whenever you are passing a duty area as input to a function you

222
00:15:14,570 --> 00:15:16,360
have to pass the number of columns.

223
00:15:17,240 --> 00:15:26,000
So here the name of the edit is actually e you want to give em man you will give an.

224
00:15:26,040 --> 00:15:27,210
So what do we are doing here.

225
00:15:31,060 --> 00:15:32,940
So what we have to do here.

226
00:15:33,010 --> 00:15:38,380
So if you remember that I told you that whenever you want to pass our duty to a function you have to

227
00:15:38,380 --> 00:15:43,200
give number of columns not the number of rows and the middle throws out option number of column sideman

228
00:15:43,210 --> 00:15:44,130
duty.

229
00:15:44,230 --> 00:15:49,570
So I am creating an 80 of five routes and hundred columns.

230
00:15:49,710 --> 00:15:51,750
Then take value if I meant it as input.

231
00:15:51,750 --> 00:15:58,120
I am taking that is input then I'm cutting the function print diary I'm giving M and Eddie so eminent

232
00:15:58,120 --> 00:15:58,830
that correct.

233
00:15:59,010 --> 00:16:06,020
But here what you are doing you are writing e if I G and what is the formula for AIG.

234
00:16:06,040 --> 00:16:07,000
So the form lays.

235
00:16:07,180 --> 00:16:11,490
I multiply columns plus G.

236
00:16:11,500 --> 00:16:18,860
Now my question is how this function will be able to find the value of c c is the number of columns.

237
00:16:19,090 --> 00:16:24,070
So there is no way that this function can find out the value of c.

238
00:16:24,240 --> 00:16:27,990
So what we have to do we have to pass the value of c and how we will pass.

239
00:16:27,990 --> 00:16:30,900
So this is C so C is actually a hundred.

240
00:16:30,900 --> 00:16:32,180
So you have to pass handed.

241
00:16:32,550 --> 00:16:34,500
So that's why you have to write under there.

242
00:16:34,500 --> 00:16:36,330
So it was a Lear 5.

243
00:16:36,330 --> 00:16:37,950
Now you have to write under there.

244
00:16:37,950 --> 00:16:43,290
That's why I told you that whenever you are passing you are to the area as input to a function.

245
00:16:43,650 --> 00:16:45,930
The value of the rule are optional.

246
00:16:45,930 --> 00:16:46,920
You give or not give.

247
00:16:46,950 --> 00:16:51,260
It is your choice but the value of columns have to be given.

248
00:16:51,270 --> 00:16:56,570
So you have to give the number of columns and the to match these two value should match not intended.

249
00:16:57,470 --> 00:17:03,980
Then only this formula is valid then only we will be able to find out the correct index.

250
00:17:04,010 --> 00:17:08,110
So if you will pass handed here then C will become hundred.

251
00:17:08,120 --> 00:17:09,580
So that's why whenever.

252
00:17:09,710 --> 00:17:13,760
Always remember the value of column is very very important.

253
00:17:13,820 --> 00:17:15,940
So that's why you have to write under there.

254
00:17:16,010 --> 00:17:25,380
I hope I am clear to you and all of this is valid because our systems to our to the error in draw major

255
00:17:25,380 --> 00:17:26,030
form.

256
00:17:26,070 --> 00:17:27,930
This is your one theory.

257
00:17:28,110 --> 00:17:34,530
So your to the idea will actually will be stored in this one the very first the first one will get stored.

258
00:17:34,560 --> 00:17:40,140
So first row will come here then second row then third row will come then fourth row will come then

259
00:17:40,140 --> 00:17:40,920
fifth row will come.

260
00:17:40,920 --> 00:17:43,060
Then six will come and so on.

261
00:17:43,080 --> 00:17:44,160
So for a row major.

262
00:17:44,180 --> 00:17:51,340
This is the formula and I hope you can remember this homeless remembering this one life is really important

263
00:17:51,550 --> 00:17:59,260
and I hope you guys know that why you have to pass the value of columns to the function and why we have

264
00:17:59,260 --> 00:18:06,430
to give the value of columns when you are creating a duty 80 because of this formula and because of

265
00:18:06,430 --> 00:18:12,160
how do the ideas are actually being stored how do the ideas are actually getting stored in our system

266
00:18:12,160 --> 00:18:13,040
memory.

267
00:18:14,170 --> 00:18:18,430
So if you have any doubt in this concept you can definitely ask.

268
00:18:18,430 --> 00:18:20,290
I will see in the next video that by.
