Download as pdf
Download as pdf
You are on page 1of 18
hs C eesaieyduto: DSo74 @ given cet oF elements USIN- the Buick com method And aetermind the Lime PeHnired +0 Sort the Clements. Reopen THE EXperimert for Hicfenent val DF No. » ThE Number 0F Phe Clemente fn the Not to Se Sorted ane plot % Jraph OF the time taken verson 1. The elements CON be read From a Ee by CAN OC Qenerncted SIMA The wando™ Number generator. Cot: — tinciude Hr neludes conio-4> tHihnctudes SY8[time A> vetd Swap tater fot *y) int teMP; tomp = *?t, tm = *743 “Md - 2StEALa0YO *y - temp; z oo roid generate, random (int att, int 9) v a $ , ‘fot 03 } Stand (timed 09); for( to) tan; ttt) ali) 2 rand) 21000, : 2 ' fot fax tition 19t a Gv}, inet, rat A) te A s aoe V tee 6 SPS tots Tsatt3 P= Po J goin gwrire((&=Ds S Sprapo( paid, 8902); - swap (3 907, 89049); yetun J > c Pat Buick sort int aj, fot ™, int n) £ int 9; fe (ment) a S = Pareition(a.m), BedoksovF(a,m, S-1); ick , BuickOo#l9, stn); yen a; 5 7 fot maind fot @ (7000009, Ocha: Stuer timeval t 5 Aouble Ctart, end ; ALE * ep: pointe Enter the type oF eperations \n"); printe te rondo generate umber and BLS \N”): brinte( “2- Ranctomig generate NUN Nf BUickKSo7 \n”) seané (“ 24" Beh); Susitea (cm): $ case t Ep = Fopen (“Buiexsom, ext”, “w)- é PTO Want RAM KOR: For t= 100000: “eyp0000 ; f=" 15000) pl - RSE AYO $ generate random (9, Oo; gettime ofdoy( at, MULL); Stary = 4. tv. Sect (1. tv Lye /J0 000000 . 0), Guufex sora (9D, t-1)3 Qettimeoklog se, NULL): end ~t.tve see + (t. ty_w-e PEINCLUAC ES seidh'o.n> TH notes < toniv-4> int mac) § o - 7 , Vent arrort 20 (20) v, 1, J Lount =o» Fat Tobl19], 2, Sem, fnreqeree (ao), Frag. PINES Enter tre unser oF vertex \n)s cant nd”, BV), printe( Enter the numer oF Qdraeey matrix ”)- for([ so; (eve (#4) ¢ y for (T2235 Tev; +t) ” seanet nq") 8 orre¢C/I GI): 5 white (eunt Se, ; 7 ¢ P.F-o S$ oe C indegwee (1 °) y : Zr Aag ot) break é te ( Flag) 5 pointe The Aber graph cannet $e Sorting 44199 tepeleyy $07? "); exit{o); t forllto 3 dev itt) avreg (23 (5) = 9} indzgree (2) = -1; Job [count] = 2413 Ceunt tt; prenet The topology order fs...\n”); fort (20; (x lount 5 C+) printe "hel \t", Job (iI); printe( \n"'); rete 05 % P.To ob O. Find a cunser of 4 Jiven set op 4S 82, ).. $n2 66 4 positive integer whose won fe €6Ual $0 4’ given positive Integer. , For example. fe 62818 4 56 83 and 4-9 there re two Solutions 14,64 And $1472. 4 suitosie message fs to be isproged IE tht Giron poobiem ft fone ds, Oye Yiren problem Instone Set coe Cea YSOg crt thinourde < jastream. h > Pine ledeg ct qetr's 4 5 thdeting niax 20 using NAMESPALE Ltd; Int stk (Max); fot set Cmax; int Sizes int tepr-r; Int Cz veld push Lint 1) $ * te (top = = MAX-1) ; Y Cout<<“ no more plan” ; exit (2); 3 e4ge sek (+t tery =7t5 8 Veid Ppl) 4 fe (-topse) ‘ ne Cout<< Mo elements’, exit), 7 LIL top--@; pro | shen RAUHT Bhs - RSE B0YO | void oye’ A splay) ¢ a s ” Cort o) 8 ° ° . fos | U=Pes; (er sgize 7s ttn) § push (ser Eo, Susset ( rel, Sto eset Ct); Pera, 5 pe Se ==) t Ei fi splaqt); houndsein = 15 7 retin found Sen 5 4 int mei) s \ . , pat 6, Sw; Cout << “Enter the Cin p> HM; maximum numbers oF epements ”); ae Enter the epements (n”)! For( ters Cersizes rad) Set; COU “ Enter the yem@uiree/ Se :"); cin> Cin >> Sum; Cout Hi qetucle< Pomanipk> 4h deFine MAX 10 ysing namespree std; fot path(maxd; statre int K=O; int Count=0; int perm (12094) 5 fot tourcost (120); veld swap lint Forint *Y $ ine tenp; tempi*n, mH "7: ye tenes Void DES (fot c, int vomax, Int glinaa fore hat Y) fat vs vieJzte patr (k++) =; For( tro: tons (t+) i tE(FEIO BA tv) fe DES ULV. En); | | b | Void permute (int acd, int ¢, igt 1) < ° , No fat SK red fsom) for (E20; Kam, K+4) perm (count) (Kt 2 90K; count++} 5 else f forte 1) S220; 54D ° susap((940, (a3); permute(a, Caryn); cwapl (94 YA 44))5 5 tne * apersp {fat a, fat tone AX Eman) int Ld, v,4, min, excest=D; 2 ae fot sum, et fend {23, POVAX), AMATI, Sra), tree Cran Grn) Pat Source, Count: Pat visited (MAX) 20 min> 999 , Source so; ee er) r for( dso, J cost Ceourse] (iJ; SCJ =; pli cSoure; s (gourd) ets Sums 0; | o> Count = ©; wiilec count J 59-0) min 2999) Ur-ly fos[ i 0; fxg itt) ¢ eS C5) = 20) £ PPo “Ub + LSE B00 HE (4057 <= min) S ’ mrn 2 40S); bens) } eee) mu tOeI 013 = POI; kt Count +t; sum pe Cost(yT la); S(uy it; for( Vz Of; VAN VED : 1e(Stv) T= BA cost WTS IOD) e avy = cost CIOT; ply) 24 ; 5 ' for( (0; ten ttt) fortdzo; 3= 999) . Cout ce {n Mo min Cost shan tree An"): ese es y s . foo (= 05 Vans a4) < ’ . r? free 4 OI CN AOIO = 5 ? PES (0, visited tree ,n) Cortex “Ini Approximate Loutt fous sf "<< Ondl; fort (20; Ven ks C44) § Ts ” Cont potaty CF<< “> 3 exceste = ost (Poth C/V poth C(4) 5 , Cour e< path (oJ; gree COVOTATHI() =1; } fot nuunoe CFS ena fot joterér ties 2-1, GS; iat met > 997, metindex, append ; fost f= 0, Cen; ft) city C3 ett pesmute (HY, 0, intercities 1) 5 for Fan-t; I> 5 te) Fact = fact *) ; For( (0; (” (Loot) appmer (met ; Cot ge (LU Aeet)appmer) met)-1)™ loo Optimat tour Ing. rerum 0: Cot ce Hy, Aetteray includes stdfis,4> thinclesle< syspime > tHhinelooles omp.h>- deste Senattroyd lint FreprlieI le), fat ver dousre ASHI, feuste 4204; $ $ yt C5, K, fakloyg Cerin): Street timeval ous qettimerdog (sty, nivie)- ASIF = Lv. tv_ seer Lty. tv vsee/ 0000000 os fort (20; Fever: fray 4 . Fo S=0) jever > yea) f ioFloyd (I) = grapnCcjp)- 3 2 ; PURI) Kcc ver seat) a fort (20: (’e vers C++) $ é for{ Jz0: d tv. tv_ sec tltytve tte / 10000000. 9 J: wetum 4end~ $4077; % Int maint) int graph (eI (10), ver, (Ss double 184097, den, Times, TrmeP, Fqetor: bantet“tn Enter the numer of verpexs””): scane“ Af, aver): Ponte“ Ia Enter tu rez OA Fase matrix \n’ Oe Prt iso; fevers faa £ fox] Jr; dccver; Std) ; u on 74") Rgqrepr€ c] G)); t Tres = Serio (Fraph, ver, 4810, dang); Fimep = PATHeerd( graph ver stort, donq): pomre (“Time Taken By seriat fyoyy =hEIN” Tr mes %)- pune Time Taken By parallel Floyd = 26 In" temeP): Facts = Time? /Trmes)* 100; Print Porasiet Floyd fs HE percust time faster than Senal Floyd\n”, Facror): ) wetum 0; > a eas thné: apisi’ HH. “fll - 22S 0Ee/G08 4.0: Eng

You might also like