1
00:00:17,830 --> 00:00:22,990
So the last class we were discussing about
what to decide we decide about the model right
2
00:00:22,990 --> 00:00:30,610
now or regarding a much particle now today
first will be discussed over into algorithm
3
00:00:30,610 --> 00:00:35,530
and then we will discuss the main sorting
algorithm and finally we will try to consider
4
00:00:35,530 --> 00:00:46,550
an example or two which because through which
you can see How the robots know.
5
00:00:46,550 --> 00:01:07,540
In the horizontal merge first part the problem
is that suppose you have J cross K the problem
6
00:01:07,540 --> 00:01:30,070
is that this is increasing order this is decreasing
order and you want to marge it right in order
7
00:01:30,070 --> 00:01:35,730
to do that.
8
00:01:35,730 --> 00:01:47,050
First we need to define a two column merge
that problem means that you have one column
9
00:01:47,050 --> 00:02:04,360
J rows
and two J elements say you have a 0 , a 1,
10
00:02:04,360 --> 00:02:20,590
a 2 ,a 2 for simplicity right a1 a 2 a 2 J
is 2 J elements you have which is the byproduct
11
00:02:20,590 --> 00:02:47,881
sequence is the second one is absent and the
other one is and the other this is 1873 four
12
00:02:47,881 --> 00:02:59,780
+ four eight nine thirteen seventeen so a
1 a 2 a 2 J is a bi-product sequence and the
13
00:02:59,780 --> 00:03:03,340
elements are stored in a column of zeros.
14
00:03:03,340 --> 00:03:25,690
In such a way that you have a 1 a 2 AJ and
then a J +1 to a 2 and let us assume that
15
00:03:25,690 --> 00:03:43,170
this data is stored like this I see P0, P
1, P J -1 right this p 0 p 1 p j - 1 at the
16
00:03:43,170 --> 00:04:00,270
process And this is in RS register this is
an RT register for RR register so you have
17
00:04:00,270 --> 00:04:06,129
a 1 ,a 2, a 2 j element is forming by 2 D
sequence and the and you have a column of
18
00:04:06,129 --> 00:04:18,560
J rows and J rows and each row is assigned
to a process p 0 to p j- 1 and I need the
19
00:04:18,560 --> 00:04:27,760
row contains .
The AI and AI + j agree A I is in RR registered
20
00:04:27,760 --> 00:04:38,770
and Ai + j is another register so what you
are going to do it see the simple thing is
21
00:04:38,770 --> 00:04:43,159
that in the binary sequence is based on the
only one provided that the AI is compared
22
00:04:43,159 --> 00:04:54,809
with the I + L so this is ready for you then
this has to be compared this has to be compared
23
00:04:54,809 --> 00:05:05,529
okay so if you compare and rejected element
will be in this side and accepted element
24
00:05:05,529 --> 00:05:08,599
will be this side right.
25
00:05:08,599 --> 00:05:18,919
Know after that I want to do it recursively
right so what happens here then after comparing
26
00:05:18,919 --> 00:05:25,439
this elements will be this elements will be
a binary sequence these elements will form
27
00:05:25,439 --> 00:05:31,729
a binary in this sequence and all these elements
will be less than or equals to this one agreed
28
00:05:31,729 --> 00:05:38,910
or not so and then recursively we will be
solving these two so same idea that you have
29
00:05:38,910 --> 00:05:52,210
this one compared exchange compare exchange.
Now you have to bring these elements in this
30
00:05:52,210 --> 00:06:01,930
job and these elements should go in this job
if I then see then this will becomes a binary
31
00:06:01,930 --> 00:06:06,099
sequence this will began other binary sequence
and all these elements will be smaller than
32
00:06:06,099 --> 00:06:18,789
this elements yes no any confusion I am what
I am doing this is compared with this the
33
00:06:18,789 --> 00:06:27,219
rejected elements are lying here accepted
elements are lying here anyways now.
34
00:06:27,219 --> 00:06:33,319
I want to make it these two hubs you not to
make these two hubs and recursively I want
35
00:06:33,319 --> 00:06:40,029
to use it so this half should be interchange
with this half so that this forms a bite onic
36
00:06:40,029 --> 00:06:45,749
sequence this form another binary sequence
and all These elements will be smaller than
37
00:06:45,749 --> 00:07:13,139
this element and then you do it occurs simply
say for example.
38
00:07:13,139 --> 00:07:55,740
Tell me why two elements of here 1 to 15 so
this is a binary sequence you have right and
39
00:07:55,740 --> 00:08:06,249
this is in order we discuss and what we are
doing that he is to be compared with the I
40
00:08:06,249 --> 00:08:13,860
+ n and the accept elements in our this area
and registers and so believes that case you
41
00:08:13,860 --> 00:08:58,810
get the result of this like now you observe
from these becomes of binary sequence you
42
00:08:58,810 --> 00:09:07,550
know you want to use the same algorithm you
want to use the same algorithm for you.
43
00:09:07,550 --> 00:09:13,590
So what I want to use same algorithm then
these elements should be here so then I get
44
00:09:13,590 --> 00:09:23,000
the binary sequence and these elements should
be here so that I get another sequence.
45
00:09:23,000 --> 00:09:41,010
So what are you so if I interchange it I get
two
46
00:09:41,010 --> 00:10:05,060
one two five eight seven six four three and
you get 15 ,14, 12, 11 ,9 10 ,13, 16 right
47
00:10:05,060 --> 00:10:14,070
so you get you observed that you get to buy
tunic sequence and all these elements will
48
00:10:14,070 --> 00:10:24,500
be smaller than this elements now he gave
you perform but two hops compare exchange
49
00:10:24,500 --> 00:10:34,870
and then interchange these two elements.
50
00:10:34,870 --> 00:10:56,050
So you get here 1 , 7, 2, 6 ,4 ,5 , 8, 9 15,
10, 14, 12 , 11 ,13, 16 and if I interchange
51
00:10:56,050 --> 00:11:49,380
this 2 I get 1, 2, 4 ,3, 7, 6, 5 ,8 ,9 ,10
,12 ,11 ,15, 14 ,13, 16 now you observe that
52
00:11:49,380 --> 00:11:54,100
this is a cluster of four element this is
the cluster another four elements and each
53
00:11:54,100 --> 00:12:15,240
cluster is a bionic sequence and again you
do compare exchange.
54
00:12:15,240 --> 00:12:25,020
So comparing change and then interchange so
you will get
55
00:12:25,020 --> 00:12:46,760
the then 5, 6, 7, 8 ,9, 10, 12, 11, 13 14
,15, 16 right and then you get basically eight
56
00:12:46,760 --> 00:13:18,760
such biotic sequence we just do the compare
exchange you get 1 ,2 ,3 ,4, 5 ,6 ,7 ,8 agree
57
00:13:18,760 --> 00:13:40,600
so you get the sorted sequence in this form
right here know if you are good I could have
58
00:13:40,600 --> 00:13:46,630
done after doing the compare exchange you
observe that this sequence is a binary sequence
59
00:13:46,630 --> 00:13:51,810
this sequence is a binary sequence and all
these elements will be smaller than the same
60
00:13:51,810 --> 00:13:56,120
here.
And now I could have done the column one let
61
00:13:56,120 --> 00:14:04,200
us run down the column one and I could have
got this cheap the pool like that 1, 2 ,3
62
00:14:04,200 --> 00:14:16,690
, 4 ,5, 6, 7, 8 like there which I need for
horizontal mark do the whole digital model
63
00:14:16,690 --> 00:14:26,160
this will be like this not this so that is
the reason why instead of bring the column
64
00:14:26,160 --> 00:14:31,830
marge we are doing the indexing spot and then
we are repeating the column marge So that
65
00:14:31,830 --> 00:14:47,180
the DJ is to final data stored in this form
is it okay.
66
00:14:47,180 --> 00:15:36,620
To column Marge first step is that perform
compare exchange operation between RS and
67
00:15:36,620 --> 00:15:47,710
RR registers right we have already assumed
the data is in the form that a 1, a 2, a 3,
68
00:15:47,710 --> 00:15:58,150
a 2 j in such way that the I and A I + J is
in the IF row and our RS and RR registered
69
00:15:58,150 --> 00:16:07,960
respectively now if J is greater than 1 if
j is equals to 1 that means there is only
70
00:16:07,960 --> 00:16:13,510
one rope and that means that you have the
only two elements.
71
00:16:13,510 --> 00:16:18,730
Which form the whitening sequence just one
compare act is sufficient to make it sorted
72
00:16:18,730 --> 00:16:29,790
form now if J is greater than 1 what are you
going to do the rejected element has to be
73
00:16:29,790 --> 00:16:49,120
compared has to be interchange except an element
of that so interchange content of RR of CI
74
00:16:49,120 --> 00:17:20,679
I is 0 2 j by 2-1 with RS of PK k JY - 2 J
- 1 how is going to do this.
75
00:17:20,679 --> 00:17:35,809
(Refer Slide Time:17 :30 )
See what we told
76
00:17:35,809 --> 00:17:54,010
this has to be interchange how are you going
to do that huh x equals two interchange what
77
00:17:54,010 --> 00:18:17,030
is X how will we get this two L this is in
P I and this is an APK and it is in the form
78
00:18:17,030 --> 00:18:30,919
of merged PI is connected to its only yes
that is the reason why we need RT so the elements
79
00:18:30,919 --> 00:18:45,899
here you move to RT then bring down next step
you bring down all these elements here then
80
00:18:45,899 --> 00:18:51,700
you interchanges this then you bring back
here it.
81
00:18:51,700 --> 00:19:01,460
So this is the stir and then finally you move
again this elements now after interchanging
82
00:19:01,460 --> 00:19:27,629
you will be doing two column Marge give I
to PJ by 2 x p0 speed J by 2 - 1 and 2 column
83
00:19:27,629 --> 00:19:48,379
Marge J by 2 PJ by 2 PJ - 1 simultaneously
right both of them can be done in parallel
84
00:19:48,379 --> 00:19:56,580
agree so if it is the case then what is the
time complexity.
85
00:19:56,580 --> 00:20:26,159
(Refer Slide Time:20 :11 )
And you have TR 2C B if J is equals to 1 then
86
00:20:26,159 --> 00:20:37,629
it is j= zero there is no de right now if
J equals to move the it gains greater than
87
00:20:37,629 --> 00:21:02,269
one you obviously you have TR j y to see class
what is the routine equation this data has
88
00:21:02,269 --> 00:21:13,679
to be moved here right and then exhale again
you are moving back so what is the routing
89
00:21:13,679 --> 00:21:31,169
step this is this data you are bringing here
how are you going to because I told you the
90
00:21:31,169 --> 00:21:39,919
routing RR resistor is the only register through.
We reconsider words oh all of you are on it
91
00:21:39,919 --> 00:21:56,100
do you know this one you are studying here
RT no this one you want to store here this
92
00:21:56,100 --> 00:22:03,509
RS contains the review or you will be there
honest contains you cannot touch RS these
93
00:22:03,509 --> 00:22:13,720
are res is all accepted data this you want
to retain here this contains all rejected
94
00:22:13,720 --> 00:22:19,940
data but you want to keep them here only this
is that this part has to be in touch in with
95
00:22:19,940 --> 00:22:27,929
this point we're all to do that the and your
routing is done through our register only.
96
00:22:27,929 --> 00:22:37,970
So you move this data here you bring this
data here interchange these two then you send
97
00:22:37,970 --> 00:22:49,889
back the data here okay then this you bring
back so this you do one of the method.
98
00:22:49,889 --> 00:23:00,720
So you need our routines are by to this side
again our y going back you need our routines
99
00:23:00,720 --> 00:23:28,999
are this so RJ now what
100
00:23:28,999 --> 00:23:45,680
is the solution of this we should gain 2 to
the power tell me what is the solution next
101
00:23:45,680 --> 00:24:04,840
one is number of exchange operations the number
of comparative it is one if J=1 otherwise
102
00:24:04,840 --> 00:24:34,049
it is 1 + P 2C j by 2 because there is no
comparing that operation so I write 1 + P
103
00:24:34,049 --> 00:24:55,919
2C to C j by 2 here this solution.
And this solution what about here there is
104
00:24:55,919 --> 00:25:12,059
no exchange up against if J equals to 1 this
side n breaking Te to c JY by 2 class how
105
00:25:12,059 --> 00:25:19,929
many exchange operations you are performing
here first is one is you are bringing data
106
00:25:19,929 --> 00:25:29,080
I hear that second is you are bringing data
here in the exchange operations right then
107
00:25:29,080 --> 00:25:35,950
you are sending back through routing then
again you will be bringing the data here 3
108
00:25:35,950 --> 00:26:01,260
right 3 or not so it is 3 it is
what I am saying.
109
00:26:01,260 --> 00:26:23,549
No impact on so if I put to one suppose J
equals 1 let us assume nothing J equals to
110
00:26:23,549 --> 00:26:41,070
two answers would be J goes to answer form
3 J goes to 3 and J goes to 4 answer will
111
00:26:41,070 --> 00:27:51,369
be 7 so what three see the 3log j if these
= 1 it is 0 & 2 it is 3 & 3 hold D 6 and so
112
00:27:51,369 --> 00:28:02,529
under there what is still of this so the two
column and is done because that you want the
113
00:28:02,529 --> 00:28:12,210
data should be in such a way that that all
the elements in the first row smaller than
114
00:28:12,210 --> 00:28:15,690
the old element in the second row and so on.
115
00:28:15,690 --> 00:28:28,929
So this idea is used in the horizontal bars
so the elements you have in this form such
116
00:28:28,929 --> 00:28:49,479
that it forms a biotic sequence and we bring
this data here okay so initially if you remember
117
00:28:49,479 --> 00:28:56,789
this forms a battle in sequence now you will
observe that these elements and each this
118
00:28:56,789 --> 00:29:07,659
elements this has come here this also will
form a vital in sequence agreed or not yes
119
00:29:07,659 --> 00:29:24,059
or no see you have to binary sequence right
now if this is an inclusive orders.
120
00:29:24,059 --> 00:29:33,109
Then this column is also in increasing order
right if this is decreasing order then this
121
00:29:33,109 --> 00:29:39,239
column is always decreasing order now if I
bring this data here this forms a binary sequence
122
00:29:39,239 --> 00:29:49,659
right because this was increasing order this
was decreasing order agreed similarly if I
123
00:29:49,659 --> 00:30:02,970
bring this data here I get another binary
sequence here and so on with which also and
124
00:30:02,970 --> 00:30:09,389
also if I merge the two column merge here
then all the smaller elements should be here.
125
00:30:09,389 --> 00:30:23,789
Next column and elements will be here and
so on yes or no similarly the case okay so
126
00:30:23,789 --> 00:30:31,289
what I do I reject element and sent back again
these selectively remains are elective elements
127
00:30:31,289 --> 00:30:40,679
in the first row right so they are not here
these elements are smaller than this elements
128
00:30:40,679 --> 00:30:46,840
so all these elements will be smaller than
this elements similar all these elements will
129
00:30:46,840 --> 00:30:51,509
be smaller than this elements.
So even if I am sending the rejected elements
130
00:30:51,509 --> 00:31:00,419
these elements are smaller than these elements
and also each this will form a binary sequence
131
00:31:00,419 --> 00:31:12,679
this okay and then you do the simple rumors
on each of them you will find the sorted sequence
132
00:31:12,679 --> 00:31:21,970
so let us consider first one example before
we discuss the algorithm 16+16 okay.
133
00:31:21,970 --> 00:31:46,659
1, 2 ,4, 3, 5 ,6 ,7, 8, 9, 10, 11 ,12, 13,
15, 16,17,19,20,21,22,23,24,25,26,27,28,29,
134
00:31:46,659 --> 00:32:04,279
30, 31,32 so you
135
00:32:04,279 --> 00:32:38,450
have suppose these 32 elements and this form
increasing order this form decreasing order
136
00:32:38,450 --> 00:32:46,340
right and you observe that this whole thing
is about botanic sequence what we are doing
137
00:32:46,340 --> 00:32:52,149
I am bringing these elements in the first
column these elements in the second column
138
00:32:52,149 --> 00:32:58,370
this elements in the third column this elements
in the fourth column.
139
00:32:58,370 --> 00:33:08,340
So you get four I am not writing now this
part
140
00:33:08,340 --> 00:33:23,950
I get 139, 229, 426, 725, 823, 132, 258, 679,
211, 1 24, 10 2, 7 ,9 286, 32, 5 there I do
141
00:33:23,950 --> 00:34:07,119
two things then I do the
142
00:34:07,119 --> 00:34:32,820
two column merge for each column what I
143
00:34:32,820 --> 00:35:16,220
will get 1, 8, 9, 14, 19, 23, 24 ,27 31 what
about here 2 ,6 ,12 ,13, 20 ,28, 4, 5 , 11,
144
00:35:16,220 --> 00:35:46,590
13, 15,18,26,3, 7, 10, then you get 3, 7 ,10
,16 ,17 ,24 , 25,22 right then we send back
145
00:35:46,590 --> 00:36:17,450
the rejected elements to his so I get 1 2
4 3 8 6 5 7 9 12 11 10 14 13 14 13 15 16 19
146
00:36:17,450 --> 00:36:51,520
20 21 19 20 18 17 23 22 21 24 27 28 26 25
31 29 13 32 right this
147
00:36:51,520 --> 00:37:03,130
rejected element.
I sent back now first thing you observed here
148
00:37:03,130 --> 00:37:08,336
that all these elements are smaller than this
elements all these a little smaller than this
149
00:37:08,336 --> 00:37:19,300
elements second thing you absorb now after
sending make each of them is vital in sequence
150
00:37:19,300 --> 00:37:23,360
and all these elements are smaller than this
element I sorry all these elements faller
151
00:37:23,360 --> 00:37:28,000
than this elements all these elements further
than this elements and so on so you can introduce
152
00:37:28,000 --> 00:37:37,660
the robot here row mod 0 mod 0 mod here and
so on and finally we will get the sword acceptance
153
00:37:37,660 --> 00:37:39,580
yes.
154
00:37:39,580 --> 00:37:44,160
So you have chosen to merge J K okay well
tell me what should I write initial data is
155
00:37:44,160 --> 00:37:52,240
in what you decide whether it is an artist
finished or register that is assumed data
156
00:37:52,240 --> 00:38:05,270
is in our register in that case we assume
the data is in RR register then what do you
157
00:38:05,270 --> 00:38:20,320
do what exchange first thing is that compare
how will you go huh how can you shift it because
158
00:38:20,320 --> 00:38:29,920
they are only not a resistance that you have
decided so perform exchange of connections
159
00:38:29,920 --> 00:38:52,480
in the first half right so first is perform
exchange the position between RR and RS of
160
00:38:52,480 --> 00:39:16,600
P I or by PI, I is what 1 to 1 or 0 0 to K
by 2 - 1.
161
00:39:16,600 --> 00:39:34,790
So actually CIJ should write P IJ but for
all yet for all you right so your perform
162
00:39:34,790 --> 00:40:12,730
that then get the data or RR from PIK to PIJ
where not idea is what I refers to what I
163
00:40:12,730 --> 00:40:35,530
refers to what row so I made mistake here
this should be J this will be I this should
164
00:40:35,530 --> 00:40:58,550
be here by 2 + J and for online JS 0 to K
by 2 - 5 right then, then you perform two
165
00:40:58,550 --> 00:41:45,220
column bars for each color for each column
like send get here of RR from PIJ by 2 + J
166
00:41:45,220 --> 00:42:09,360
for all I J 0 to K by 2 - 1 next part form
change operation
167
00:42:09,360 --> 00:42:30,640
between RR and RS by P I J for all I J is
0 to K by 2 - 1 right.
168
00:42:30,640 --> 00:42:43,030
So I get back the accepted elements in R are
officially so I have done up to up to this
169
00:42:43,030 --> 00:43:09,450
up to this now I have to do the Romans here
you write issue there are 2 J Biotonic sequences
170
00:43:09,450 --> 00:43:44,930
each of size K by 2 perform row merge K by
2 on each Biotonic sequences byte on acceptance
171
00:43:44,930 --> 00:43:59,070
so this is the steps involve in order for
March now the question is coming to obtain
172
00:43:59,070 --> 00:44:15,730
the time complicity PR horizontal to merge
J comma K tell me what is the routing so you
173
00:44:15,730 --> 00:44:43,400
have you have tr2 column merge J + TR row
merge K by 2 + right this is whatever you
174
00:44:43,400 --> 00:44:57,700
need it that I have added whatever you need
in here that I have added and what is the
175
00:44:57,700 --> 00:45:15,790
number so this is one routing steps and this
is another routine stuff so this is K agreed.
176
00:45:15,790 --> 00:45:21,980
So can you tell me what is the solution for
this what is the solution for this I have
177
00:45:21,980 --> 00:45:33,200
just how we obtained which is 2 J - 2 what
about this
178
00:45:33,200 --> 00:45:55,310
one row merge K by 2 row - K is what 2K - here
it is K - K - 2 K is replaced by K by 2 agreed
179
00:45:55,310 --> 00:46:13,340
or not yes - P is constant actually + K so
this gives you 2 times J + K - 2 now what
180
00:46:13,340 --> 00:46:25,930
about a change horizontal modes J comma K
whatever time you need is change for them
181
00:46:25,930 --> 00:46:50,280
to merge J + so here one exchange operations
here are another exchange operations so two
182
00:46:50,280 --> 00:47:04,250
exchange operations you are doing right.
So what is TE this is not this one T log get
183
00:47:04,250 --> 00:47:27,550
what about this one who dropped a by 2 + J
+ to agree so it is C 1 J + 2 okay no there
184
00:47:27,550 --> 00:47:52,130
is no comparisons here except me here and
so I can write T C HM JK is whatever time
185
00:47:52,130 --> 00:48:10,580
you need compare you need 2CJ + ECR KY 2 tell
me this one is going to use JK log J what
186
00:48:10,580 --> 00:48:25,640
about row merge log K by 2 so I can write
log K - 1 no you know what is the what is
187
00:48:25,640 --> 00:48:32,470
vertical merge and what is what is a horizontal
merge you are ready to write the sorting algorithm
188
00:48:32,470 --> 00:48:36,030
so when writing the sorting algorithm you
have to keep it in mind in the battening in
189
00:48:36,030 --> 00:48:39,120
the form of battening sequence first is that
one sequence will be in ascending order and
190
00:48:39,120 --> 00:48:42,960
the other in the descending order .
191
00:48:42,960 --> 00:49:03,510
First one is 4 + 4 this is the battening sequences
this is the another battening solution arranging
192
00:49:03,510 --> 00:49:28,470
the in the form yes or no the put it in one
particular one in the form right and every
193
00:49:28,470 --> 00:49:44,220
time you have to keep track so to do that
I need to know what is the stage number.
194
00:49:44,220 --> 00:49:57,820
I need to know a sine function to tell if
class 1 if it is in increasing order increasing
195
00:49:57,820 --> 00:50:13,940
order how I will compute the sine function
we decide later one if it is decreasing order
196
00:50:13,940 --> 00:50:21,770
so I need to know the stage first stage second
stage and so on and a sine function and the
197
00:50:21,770 --> 00:50:36,330
second thing I need to know to a variable
K to tell what is that to merge K + K, K +
198
00:50:36,330 --> 00:50:45,330
2K what did you merge 2 K + 2K what it means
that first time you will be arranging this
199
00:50:45,330 --> 00:50:56,470
way consisting of two elements right.
In the second stage in the second in the first
200
00:50:56,470 --> 00:51:00,350
page you get another one then instead of what
is it Almighty making body your mind afterwards
201
00:51:00,350 --> 00:51:11,540
which sign is become 2 K + 2K here in the
same page you will get this side two rows
202
00:51:11,540 --> 00:51:31,050
but four columns and then four rows four columns
and so on so kill with that pointer initially,
203
00:51:31,050 --> 00:51:45,040
initially we assume that K equals to 1 S equals
to 1 and you are interested to solve M cross
204
00:51:45,040 --> 00:51:54,990
M elements by M cross M processors in two
dimensional merge every processor contains
205
00:51:54,990 --> 00:52:00,320
one element so you have M cross M process
every processor contains one element you are
206
00:52:00,320 --> 00:52:24,400
interested to salt this N square elements.
K goes to one first stage s equals to one
207
00:52:24,400 --> 00:52:51,780
while K is less than M issue there are several
surveys each of size K + 2K perform horizontal
208
00:52:51,780 --> 00:53:25,770
K + 2K okay then stage is increased by one
issue there are several surveys each of size
209
00:53:25,770 --> 00:53:45,291
2 K cross 2K use particle merge 2 K + 2K to
increase S by 1 again next stage and K by
210
00:53:45,291 --> 00:53:58,790
2K so this is your main algorithms so you
observe this and this stage is somebody subtitling
211
00:53:58,790 --> 00:54:07,740
sequence and this stage is somewhere a is
in summary of size 2 K cross to fill the Vita
212
00:54:07,740 --> 00:54:13,630
mix effects here I have not told about the
sine function whether the increasing order
213
00:54:13,630 --> 00:54:17,780
or decreasing order then I will discuss separately
right.
214
00:54:17,780 --> 00:54:33,860
If it is the case then what is the time complexity
P main algorithm size M cross M number of
215
00:54:33,860 --> 00:54:48,160
proteins know if I start there are two ways
you can compare you can start 1 cross 2 then
216
00:54:48,160 --> 00:54:53,230
2 + 2 then 2 / 4 then for recurrent sample
and so on right you sure I am doing this let
217
00:54:53,230 --> 00:54:58,450
us think this way suppose I get suppose I
get this is a sorted sequence these get a
218
00:54:58,450 --> 00:55:03,650
certain sequence is getting sorted sequence
and so that this is the binary sequence this
219
00:55:03,650 --> 00:55:09,820
is another binary French right.
And then you have used what is it blue margin
220
00:55:09,820 --> 00:55:16,550
particle mind you will be getting the total
disciplines you do not know suppose I assume
221
00:55:16,550 --> 00:55:32,140
that this is sort of sequence this is sorted
sequence so this is the this is you call you
222
00:55:32,140 --> 00:55:40,660
call original mod to get a sorted sequence
so can I write here the time complexity for
223
00:55:40,660 --> 00:55:55,410
this is nothing but P our main algorithms
M by 2 cross M by 2 + P are horizontal merge
224
00:55:55,410 --> 00:56:08,650
M by 2 M + T are vertical Merge.
So I am just instead of looking for bottom
225
00:56:08,650 --> 00:56:15,460
of approach I am thinking about the top down
approach I am by some recursive method I have
226
00:56:15,460 --> 00:56:27,670
so which needs what is it - modular so this
is the time complexity somebody just mean
227
00:56:27,670 --> 00:56:34,580
you do this then you combine this using the
particle mod which is the time needed for
228
00:56:34,580 --> 00:56:50,360
doing this is this now this gives you TRM
M by 2 M by 2 + what is the time we have already
229
00:56:50,360 --> 00:57:33,190
obtained J + Y so J + K this TRM M by 2 and
by 2 + BN - 4 now issue immiscible so 2 to
230
00:57:33,190 --> 00:57:59,940
the power K or to the power M equals 2 well
you end the note is a particular module huh
231
00:57:59,940 --> 00:58:20,130
what do you got shame on this one.
And
232
00:58:20,130 --> 00:58:31,530
so it is for M
233
00:58:31,530 --> 00:58:52,290
an issue Emma comes to two to the power what
is the solution not PR m my fault cause M
234
00:58:52,290 --> 00:59:09,430
by 4 + 7 by M equals to one answer is zero
right so up to M equals to 2 you have to go
235
00:59:09,430 --> 00:59:43,410
that is l equals 2 what is the answer this
is 2 squared keep in 1 comma 1 7 what I like
236
00:59:43,410 --> 00:59:58,300
sure
237
00:59:58,300 --> 01:00:27,640
will be the solution no 7 M 1 + - 8 l and
this is 2 to the power L - 1 3 to the power
238
01:00:27,640 --> 01:00:50,610
L - 1 is 7 M , M - 1 - 2 - 4 L - 1 euro by
top into 2 - 8 n so this is nothing but 14
239
01:00:50,610 --> 01:01:12,400
M into M - 1 - 8 logger right.
Now you have T exchange main key exchange
240
01:01:12,400 --> 01:01:27,390
main M by 2 m by 2 + T exchange goes into
bars M by 2 + T exchange particle mass M by
241
01:01:27,390 --> 01:01:38,820
M what
242
01:01:38,820 --> 01:02:10,940
is the just know we obtain C 3 C log n by
2 + 2 log M okay what about this one 2 log
243
01:02:10,940 --> 01:02:42,260
M + 4log M this gives you what T log M T log
M + 2 5 + 9 logger Tem M by 2 m by 2 9 log
244
01:02:42,260 --> 01:03:14,720
M - 3 so what is the solution for this 9 logger
- 2 + 9 log M by 2 - 3 + 9y log M 4 - 3 9
245
01:03:14,720 --> 01:04:01,040
log M first case where here yeah I am right
okay so it is 14 M - 1 - 8 longer is it okay
246
01:04:01,040 --> 01:04:13,150
what about this one this is okay it is what
it is been still time easier tell me this
247
01:04:13,150 --> 01:04:48,940
is okay this expansion is okay right.
Then what is the answer how many log M nine
248
01:04:48,940 --> 01:05:25,350
log M L suspect L such so log squared n - T
times log N first one is 9 second one is what
249
01:05:25,350 --> 01:06:16,160
18 so I should take 9 over 1 + 2 + L - 1 so
I get 9 of squares M - 3 log M - 9 log M
250
01:06:16,160 --> 01:07:02,250
log M - 1 anyway so you get 4.5 log square
M + 7.5 - 4.5 + 1.5 longer J + lucky and what
251
01:07:02,250 --> 01:07:47,060
about
what again one
252
01:07:47,060 --> 01:08:00,160
log J right so this gives you 233 point 534
100 log M - 2 - 2 + 4 times.
253
01:08:00,160 --> 01:08:33,150
Log M by 2 - 2 four times log M by 2 to the
power L - 1- 2 how many logins 4 into log
254
01:08:33,150 --> 01:09:11,560
M into log M rather log M right to log M - 2
times Log M last or -, - one + 2 + so four
255
01:09:11,560 --> 01:09:33,319
times log square M - two log M - 4 times
log you volume - 1 so 2 log square M only
256
01:09:33,319 --> 01:09:40,900
right but such a simple good so this is about
the number of comparisons you need now the
257
01:09:40,900 --> 01:09:53,900
fine thing only verse you have to touch it
till can you give me to three minutes or not
258
01:09:53,900 --> 01:10:02,250
so I am here to cover it in the next class
and covered that fine.