0% found this document useful (0 votes)
6 views

Arrays 1

The document describes an algorithm for performing a sorting operation. It takes an unsorted array as input, compares the elements, and rearranges them in ascending order through a series of steps. First, it divides the array into groups of similar elements. Then it recursively calls itself to sort each group. Finally, it merges the sorted groups together to produce the fully sorted output array. The algorithm uses comparisons between elements to efficiently rearrange them into the proper sorted order.

Uploaded by

Anshika Arora
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
6 views

Arrays 1

The document describes an algorithm for performing a sorting operation. It takes an unsorted array as input, compares the elements, and rearranges them in ascending order through a series of steps. First, it divides the array into groups of similar elements. Then it recursively calls itself to sort each group. Finally, it merges the sorted groups together to produce the fully sorted output array. The algorithm uses comparisons between elements to efficiently rearrange them into the proper sorted order.

Uploaded by

Anshika Arora
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 25

_ /_ /_

~ ~Wby
hecau .ao v-1 e-.CJ.:.\n~±_ ~ - n \J a\ 11 0.11 o..t ~-um±t.m:e.·- -- -
that~ wrn; C:UO..t.(\y -hl~ ?otmct ,,coc\

Aero'(

($!:±!o,,) ±P d!lc\ a u o oa·.,,· 09:--lH G '{

0
lO t [ J OY H rn ei n ,AO i:: [5] ;
t '\
~a, o
.
moo'/ 0 u <u.
, o~o
:±ri ailoCA-to. --to a A pa. c,o •

. ---- - -
* -
4]
-
0
9:)L~o · 1 a Joco B'an [ bo + ,fd
bc,.,a e. .1 "'
ind~x

0
±____.ll"--'-=-. lo. .l.a-J~l~-<_..l,o..-Llyt3..l~::UO:t.....e~kn~~,A-thl....Ll-)..!t-.~l. .: :i±__!±L..)~~.____
- -....:/>tr~--lcr-~l..L.oL..L , _______
- - ~ ~ - - --A,~~~~~~ro~u~t- ~G~a~~~H:i_+-[~fJ~)~+,- - - - - -- ------
0

·-
1- . .
__.$ E:nba oced 1f''\l .Orop/ rf'H omb ..QDap -
-. .- •.
--- - - - - - - - -- - - - - - - - - - -----
- . __

- -~ l.>-' -----1 - ffiL.1~ n_) ~ - - - - - -


- ~ s3/ S.(O ll t u~')_,•_ _ _ __ __ _
,-._ _ __ L _
/~ .
fat cl_[_J CJ = t.
. _q 7
'\': \ I "L , 3 I lf :S I

~ ~ / ~ f 8 t~ I

'i.5.1-6 I 9 I 8I 9 S

~ - -- - - - - - - - - - - -- - - - - -

- - - - - -- -----
~ ct e ~ -

--¾ ~MD Oh
~ Cxe c, ted
I I

te_mp .:::_O"O e_

_an .e... - t-c •>o


-two .:::-__±emf-L- - - - - - - - -
11 _na:o - ½..I M.Lk.?n_~ ~t,ja..p ------
o J t)()}> o.1--t-f'--11 &., '
- ,2op u.illJ
--.111,tS""""'l....... -,~ ~e~---- /\I, T~

tn t+fcJ ,,0L1 1a_ ; . e 10 , 60 '"'111.Lb-e_p_-nokd_

-..· - - -- - -- - - - - - - - : - - - - - - - - .- : : - - -
-.._ _ _ _ _ _ _ __imn.lt:::.....J[L_j]__cQJ\fL~b..._-=--- '=:t~O..,_~~-r)- - -
~t~r02f-t.L.c2o~t...:;...3u.D-L-f1-=-i
C>
,a~~ L _L__ .0
b,
o h o
Ln_L j - 2 6

'

-.__1~ - -- - - - - -- -:;--- 0
-- -~ ~D-Jtu1l:b:Jl.ufc::....~~ti±tai:!:L:&cc____ \').J.f~rol.J~L(dL_tL:1'.1..:0.LTL.J.Oy).r.uu._07/H:AJJ.OLlt......_1u;)~~ (')U-:,l)L-.loroc..----
1 _ _

I • -._ _ _ _ _ _ _ _ _ _ _ __ _ _ _ _ _ _ _ __ _

:km P - <TI\ Q '


±r~u•'.Ju..O~;r-- - - -
-::z.-. -1..
- . _ _ _ _ __ _ _ _ _J.,J.(b1....!....l.J,a__-=--

· ______--,.,___:tLt=---1C-?----.de_mf_J;~ - - - - - -
~
I I _

~ yA>rouX e_o\JH er J + l ~, -t Q_'('( C{:l


i, >;
fat ::B!ro f ~ 0-.rt_t:D >
_ _ _ _ _.L..;.1,.::(1_[ ~ ~ ()_ --N_ [i ) _)
- - - -~~~ -fH - = i£rnf-;
- - . . 4- I,,. _, '6 Cr, \ l. ·t [J. ] \) .,
- --;;- -!J-~r~~ --t_-.V..-C-- i,._J _ ( \'
'
h
- a.:-{ -(

1
:So,, o
·a '2.o 30 i...t 9 60

-- -- - - -
11_- - -- - - -~ ~ -----:-------
----'.....,,
- --------------
---

:::

,_
I
I

I
\

- - - - - - -- - - - - - -
/-_ - - - - - - -- - - - -- -
~
-tt
-
l '1.~
--= 0L,/L 3~0
....!:: ~1_:Yu04- - ~ OL.#~~._ _ ____
:..____ -
_; ::::.+--
0
1_ -------' '
~"'-'a t
...._~[_J_~O.- :X
...L-lX 1 1

~ ~«~ ~~ipl®~~12=QO~~J~&>n~~~~- - - - -
_ ~ Ofu
- --
;__ - - - - ~f-o _t_ [_J
1 a."'--'ixu:<~ [;~o-:!.)_ .J-:+r___\'-1-1~ 1'_:::+LJOi:½tbruo~A.1.:_[L~o~'\L),0~~ -- -- -
- ~-~ CTl-=•-•< [~
!_ 1 _.c..'b...........,;, I
1 -
/4
_ _ _ _ ____, J__
"" •......1___
...... o..,'1""--- ~ e;
..L.!..th
0 tL~o""'--x~-<,,...__i.O __ Ju;~ - - - - - - - - - - - -
;_:-6~
± o ±b e" [o 1) j ~
I
1 -

,.c:.:;5 ~'
,i L
a~ Y [ o1 -t ,, ' , ,
I I

V<O l'ol ,.0, 1.1 0.p (_ \ n t: C J cm e ,.


l'a➔ C 3 -b 11 0 ) ~
-k m f2 _ o o e ._.,·~ -- - - - - - --
t u:J o ·.;
- -te..m f? ·,

1 0,I '.'.'\ e'.>O

// ,dec loood b9M +h n± ca n be


bQ ac ce ~e d b'I b? rb
- rn a Pn ~ iP \< o So ~H.i:
4-f otJ c Sm nn €b gen - D e.._u Sc on oe c (S '{S ~ 0 , a) ,

-------
==r--~dlb~0 in t C1 o.._-i;-m '-1 ~n ~ u r
• I
'-'

- tru <,e () ;
~~ ~
\n y'-f---{:_0~0LX:6::LUO..L)'¥-l').J49_ __ __ _ _ _ _ _ _ __
a

-
Sc n C, '"" ~ x l l..n L L ) ~

'1
! - - - - - - -- - - - - - - - - -- --
~ n.. Q'd):t
,,-- - - - - - - - - - - - - -- --
0

I •

--

- i
,., -- -- -- --
-r

--- --- --
-
----
p

I I
:;::::::::----
__0]ox 06 00 Arm' (

= i-10" \ 5
IT)'lOX '="-
I~ I ~o \ ~6
- oo
\

© • • i: C___ro o,x Io Aera y [a \-lli a y)~ ;

1
_ / _ ;_

--
0 ' ? : ~

,~ad e. ~ - puJ~.lf c c.1..o h-Z> Demo f

plL.b t?c. ~talfc. ?ot: ,2.foeun.SeMC'b (1n t []


Cti-!C:U ,Jn t ,ow ol)l

CJ
J te.It\f.!.:t~:)u~: __- - - -
- - - - - ---""'Jt7'--1Gca"""'JJ,lJ:Yy[::-1t~11-==--=--_L.'c~UJ

~ ~(L =- 1--f
~-- - - - -
I I

L-~~-V:::.$t-~ ~ ~~.:..i. .Lb____ ____ ____ ____ ___


~ _.JJ....L..L-L-e, ~. o ( b~1:-: nj
__..c__.._~11.r-\
.m Q. xf± '-I
&.:--_..i.....~d t\fao ~ Acfh'/ ~besl•ud be. ~rurl:ed .

,~
C fl_ .3
rs '0 -
i
lo rn ld hL

DO , ,.J P'.'.l od
, · ;::; 2-0 >I 5
, > b r =-- rn~d - 1

; ..}-t.O±t 1 /\ 0 0) fO ~

~i ~ ( on [rolc!1 < 3.1-ero~ 't


C_____J:...____ ___ ____ .1.o - roL.d + 1
--- 1
- - - ----- I
\.J.1-:i.L '!. - puhil'c. c.l o.. u- t:le.f'OO £ - ~ :-
_ _ (0_ pu.hlfc. Q-1,--!tll.'c. ~ ._( -: :- -- -- - -- '
- ~t~- - - - - - -- - ~ - --
u
:ta

Co
0
clf )t ,Oo - 0 0
;9
~a t baL Cl::6:6: 0 _o 9. aa ±b 1...
'
0 .

.
I I

f'0 5lufo.e-- .O~~aao?-\hm J'h -\-o QJOt 0fi8 e


~_:::r~ .____J~.o.-a.,.,..............__ _ _._~ _Q_y__ ~ de.c.rc ~ ?na ere T'ncr~-¾rn,t

L--;? I. ogf:, ba::f


01.
'b O\J~'I
I"\ 0
. Q ~::ru
~\.... ~,...,.
~ ~
= 9-<'. ...
'/~.I..L__f>~ _Y. el.Q.r/)~ LA..b ,. . . . ....
O :k:: :±h ew co u o..tect ~001!:tO"'O_ •.:}-he.n__5~ tlQ..CO ~
,,.,,,f \\ be. q.u±a::mon'co \\ Y oi ct Tu c o: : e s ~r ~ ?-furo

,f o Coae_ °tJ bubb\'2 ..&ox:t _ \.r-:l.Q_ J..~~17\\ be _ G.a.::n)~ _


oct:fo c 0 oJ:.- ~ tlQ.fDQ,,()b. . __ _
0 1- '2.., 3 '-t

CO LU' \ ~ - 0

"
0 I
8 8 ) 6 6 J i5 6 ') 4 Y J- '2---2_
'L ~ \.\
_ _f'-CIDnpO-.NL J -c: Q_
0

o➔"' ~
~ J-= j tj
J- o b 6 r, 8't 8 , 5't 5 ,, Y 4 , 1.'1.. l ~1- Q(

- ~ 1) .____ ___o
- -j+o-= b _t:bL / _5_5 I E.?,. I l\ Y I "l 1, . [ _J S-'t ~ )_v-.d j
j := 2, 66 1 s; 5 1 L\ Y , 8 H ,-'LL _ -- ~
0
J Jr) i (')•~ ~ ~ ~ ~I'm \
---:J:1-=-
--- b:...1--- -~G
~~ c;:: <: " 4 Y' 1 21 I _E__ 8
--------- 0 - ~<O..Jl - 1.. - CCV r'\ \t,...J
_,/

- ------rd~ -=-----a,e_~_...__-.3.________
0

,, _ .<...::,._Y_ _ _____
___________:,,O:::.__ _,_
I I

~~
0
Co ~O.:u::
~....,,..1u
n .. - ""
:J ____ _ _ _ _ _ __ ~ a ➔ Lf- \ - 1-:::"
~

_ _ __ _ _ 6.&-, ss,,~~-11_ .L B. 0-- - - - - - - - - --


_.u
'J 4-2-1
1
- - _ 7 °~ Q __ 6 6 - ,~~-ift -Q."..J.~2.-11-....08.....(8> ---- -- - -- - - - - - ~
_$jf I

J° ., . ' - -~ +-~ + 5-6-_,,__..J.2~2.'-1-


/ ~ && u___ _ _ _ _ __ __ ______
I---_- Jo ::::- ?_
,,___ ~ 5----2../ 'f4l 2 2 I -6 ½,_i&:2.)i.)__
8 _ _ _ _ _ _ _ _ __________

(_LA.
OD~..1..1.i.:ou.t~Cu\::!::1_.=::__..:
) ::___ _ _ _ _ _ _ _ _ _ __ _ _ _ __ __ ___

- -- - - - -5~5-,..1_½,.___.
\f ~2---,.,...c8:u::6y.1...c:8w..8> -- ----.::jt-=-- 4.....___\,.____._2,.....__=
----¼,
1,____
0
J - 0 lt '-I r <' C 1 <'l2 I S 6 ·1 B &

C)
COL LOt Q,)--l - 3 J z. 4 - l- 3 -:z Q

j" 0

----.,
i-
--(.ol \(). t SU:\.
- - - - - --r;- J+--:;:...=--"-
Q..,__-===:)
_ .L._....,..(~C\..__..,k= ---__,,_\_- __;C,._,O
~U.o...O~:te>-i::.=..-1--- - - -----
0
- _ _ _ _ .- -1-- - ..Y,
5c-+-G~o..,Ll.LiH.1._l=-lcri-,1_>
¾ ~ u~t-L.,Jd-~-J-J-
Q_N)____~'-+->< {_ ______

- -- - - __ ___
,.

- - - -L
- - - -
_ ;_ ; _

Coo e. ~- pu.b\ fC cl.!l-U DQ m ___


o__~- -
- ~ l tb t f'c. Q-,:la:lfc. \/ (!;l~d mo1n (_ st8ce C) ~ ) ~

,in t c1 ruut -==-- i99, s 8 , 3-3: 1_.Q__b- l~ u ___ __ _


b" bb \ e S Mt: (__a.--r ~ ) )

{M L~nt CD l I ntQ):f Q ) cot 1_I) tQ IL < 0:cf .I) le oca,:th -I ; Cn unff+ ~

~ CJot J =- o i J <o_Y'(' . i w u±b I (Ol•Ofu;l :t +)~

~ - - - - - - - - - - - - -- ---

- - - - - - - - - - -- -- -
I
- I

- - ·-

-➔ b e.uo. l 1) Q. uJo,.ryt to pu...t:. ~ma\ le»t clR.roe o:t____


CLt- 0~ 'foci
- - - -- - -- - - - - - - - - -.-~0-, -2_\---r.......;'L=--,F '3
~ ~ 'i..2...... -_ _
- .- ~ C.o~ut-L.ot!...X..QLL}<~ a..J___ __ L.:\ L\Y_:__Y_'_J\L_9_'._9.:.._,;\L:,s:..=5_j_\_
g:::...::g::...J.1....:..1..:.......l _ :
_ __ _ _ _ _ _....1..ro..LJ.....1'1-10...i_--=-:.._jO...L___ _ _ _ _ _ _ _ _ _ _ _ _ _ __

- - - - - - -- -1...0uU~)-f~~=tf)J:)J?LL0l._!
.J4,1--<.0.L~
-~c~"".l.,!,,_1
~ rn,o ::;;.:::___L._
) _LLU..lll.......
:!--===:::L.._
0
1 _ _ _~ _
-
- _ _ _ _ _ _----1Clfil-t~,-D...._[J__:,,fJ~~fJ----
, ' 0--('~ [2-Jm, a --) 0

- m,n0..---=---1- -- - - -
-- - - - ---=Q.>t.H~-1§®~Y-U-11:-Ua:::c:i~-t:C,....cnLJ1--=2 ..--P=1...L ~
0

0
a::ic1> [ro<?o) , aJ(--t [YJ ➔ rn,o ~ }

tl r
, 88.r 44, 99,• \'<:i

Col I D±f>__9-i.__--=--~1__ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _. -

- ___ _ _____.rL---J.....L.l
o S'_..... o_,_____.\_ _ _ __ _ _ _ _ _ _ _ _ _ _ _ __ _

___<bn !_~--=~~~~~~ [~2~


11---~_£_~m~~1oi---=-_~-b.-- - - - ---
0

~[t-D ~O)
- - - - OU:U :L~, 11:6:( [ y
1 CLX:! [ 3 ]

1
_,,

-?
r:,
m,o
t(\...tf\
c.)
2.
.. 2-
-
_ _ _ _ _ _ _ _ _ _'°L_ _ _ _ __ _ _ _ _ __ _ _
_ _ __

- - - - -~--( ;YYlln~ - -"-- ~ o:::c{ [co, 10,-\-fu1 1.--- - - - - -


~~ - - ~~-~)- ~8~8L___ _ _ _ _ _ _____
_ !_ /_

CD, ,flte ~ - 2- ,, ro~ '\'l


._._~_ '2
~ ---
QY H [ro~a~, ~ ~ ] ~ mt'n :::. 2.
o VY [roYol, OAA Q-tl ~ m~- O -;;- '-1
0 µy [ y 1 4==-) Cl.ill:\ -[ 2J

-- -------

(.ode ~ - P" b•t"c claw Demo t

'E6 [ay;-y [j J < oxt_[mrnJJ-L _ _ _ _ ---1

- C) 0 '
ro, n - -:}-)- - - - - - ·
1-.
I

LuQ .9.l }u y~ u ha ua cw a..b-load~ ,¥o-u1fJ


cm ~~ c.
- --~Q~U~u~a~ti~~i~ ~,J~'~~11~~1~1UJJt~~
t~ ,m~~,1uo~r~e~fil~ia~n~ ~~LJro~eun±~- - -
- - - -- - - - - - - - - - - - -
-- -- - - - - - - -
C© !. t nt::O'H
?n_
+t_ C,© 1,nto Y lJ0 ode..x: ~:-~
~ " be . o~
F19:<l-e..y
Ji
88 : \ I I 4 ':i J ~ 9 / 3 3
Cll t 1 D±R9-d -
0
-_ _ j - C& tLO -te H - 1

_ _J :::-0
Q _ _ _ _~ v~nj___~=---=-=----...Ll _.!...
I _ _ __ _ __ _ _ _
__

_ _--":E~5~C___.JOu..:9dM.;'½2:L-b[➔J-.}~----/___:
L \J~: M~)~~-
- -- - ------
- - - - - - - -~fu!~:ttl.._/...[--tJ--=+:t: :.__.!. ._,JId---____ 0
[..J-.J-J]__,_
::ill{~~l..L..tc-- ; _ _ ___.-
-'
rn_e. ~- ~l---+(...u
6 - a~t<Ht:L.._{:J-.I.0..L-\-]---.'?1---~I\,--~+-1,~- -- - - - - - -
\-~.__ _ _ -
_ _ _-4-
_f
1J
a.(...l!-Vi::l..<'. . .!. __,[f-L- -+---=-'---'a~µ}
-l ~.J
{ -[.uo~J--1;. -- -- -- -- --
I ·-.. -
1- - -
1- . - _
~
- - t
J...t Lq :_J ~ \ ] :!::. \ '-"-t
.,::Ut.~
t
~ 1' .. , t
- ~·-- - ~ .$ + '-f- "'- -+ ~ 'l ~ '3 3

('\
- - --
...
:
.... - ' - ---
GLl.LY [ ~ - "- CLl .
- --
1
l lJ ~
. _,,... _
- "'
I f ,_; - "" ----
6
:::
.
'-!o.l -
0-l.L t - -
&& I 11
1
- '
' ' Q
~
~~ {Jo+
..J
1]
[ 2J --
-,....
q9
V.t\..L
ll , Yl:1 1 8&,99,3 3
- - - - - - - - - - - - - - - - - - - - - - - -- -- - -
C&.t >. nt~ - Y
d
y-3
C\hl\ ~ 33 [J'1 \/0.Q - 6~
l\, 44 ,2g,99 ,'19
f I V ►

=--------'
0
- (t
C _1 _,_,_ Y
.._!___~L.-.fl--=Yi--=i...
Y-tf---U.8...J,;.~1-,;1--9.!.._9- l - - - - - - - - -- -
i=: \ ,-
: - - ---d"o_ -::::-___,.""'--- ,- ~- 3- ,-Y- ~- { -2- 8- ,- 9
- 9- - - - - - ~ - - -

Cod Q. ~ - plt_bq?c Jr>-+nli°c. \/~d ,f0-0QD:h0 croS&-it { fotC


')

~ (_0J't COl 1,J\ \-€,A ~ 1. ' Col 'f\ \;£1\ c,_, :=. . a \}..e9l O ( e oa;n-1;.-
,o"'
~ I
t ,. ,. I\
\I U-J.:= :::: CU-0-1 [Co< l O±Q :¼~
' -

- - - - - - - - - - - -- - - -- - - - - - -
·--___ -__t,,u_biLo_ La.illi.
&J-J- > '.:- o ~ ti <uVt cJ J ? , , o.1 )
-
t ___ -
- ·- - -QJDf
0
[ J+ l J
J
~ ~_[-J~ - - - - - - - , ,
j - - ?
I I

iliili CJ + 1] - ,, a~ ;

O\,OJ:n
0
~ Sto n ~ CJ ~ )
( o
r
& t: CJ OYH ::- ~ Q 9 1 cYn R 1 3::3= 6 c; r ?..~ j
=t_ I 1 <;-

1 ,2,2,2-,2 ,3, 3,3,91 ' '


1 1'0 ~
10• I .) fOId h?'<f'

➔ iiM CWJ! ~
0
cd P~ , 0JlwQJ4 ii ,01,rnd ctj R.,

(_1) u~dato b~b :to mid - :'.I


~ 2
{,
\ ,1 ,?;2,2... OD-b 1
1' t 1
l Qv,,) h ~~.b

~r,,) rv.. ""· lz


'ILNt t\ •· "'q 11
~~ o
- - Qcf1-l0 to d
o m 'd beca 11,0p ,o &u1 R.t
Pach o±beP-l
-◄

I
-
I

1
r - - - - - - - -- d ~ ~L - -- - - - - - - - - - - - -

d.o..t o h-P~ :to rold - ~

r - - - - -- - - - - - - - - - -- - -
- - - - - - -- - - - - - -
1-.

- - -

- - -
- - - ...

- -
- .. - - ...

- . - --- - -~- J,,,QJ ,.) -::::.


------
- .·- --
- ·- 1
,\-U1:\:: -t 'M~
- .:n_._, 0 o_,51.. 11

- .. ·-

- . ·- --...
-

0
C{Q.b.b u,/ )

L-)

a± o~ 9rdex

You might also like