0% found this document useful (0 votes)
54 views18 pages

Raushan Kumar - 22scse2120040 (DAA)

Uploaded by

RAUSHAN KUMAR
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF or read online on Scribd
0% found this document useful (0 votes)
54 views18 pages

Raushan Kumar - 22scse2120040 (DAA)

Uploaded by

RAUSHAN KUMAR
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF or read online on Scribd
You are on page 1/ 18
DSo74 a given Set OF elements USINI Fhe Buick com method l AMA getermind the time PeOUIFed FO Sor7F The Clements. Repex SHE EXperimecct for Aicferent Vault ve NO, THE Number oF Phe elemete fn the Hist tp Se Sorted ane plot 4 Irak OF the time taken verson 1. The elements CON be read From a 18 oy CAN bE Qenerceted USINA Fhe wandorn number gancrator. Cot: — tinciude HH rocltudes conto 44> > telaclude< S48[tine vetd Swap (father bot *y) < fant temb; temp = or 5 an 245 *y < teks ¢ erocte,_ random( ft ac, tat 9) vera gu Soule, fot 03 strane (timed 09); for( tro; tan;itt) ali) 2 rand) 21000, 7 fot Pav tition( < ignt 200, Fat !, rata) tet 0 LPS Let feAel; Pr doe ee me dad-% gwrire((&=Ds swap aac), 82° GD; swap ($907,290); retun J > ¢ fot Buick sor int oC), fat ™, foto) ¥ ine 9; re (ment) £ S = Pareition(a.m), Buecksovd(9,m, S-1); me : PuickCorl 9, $41); yetumn a; 5 7 fot maino ft @ Or90000,, 1, ch, 5 Stuer timevat t; Aouble Start, ene ; ALE * ep: printf" Enter the type ef eperations \n"'); printe ("te vandomiy generate umber ane{ Suite sor\n”); brine “2- Ranctomiy generate NWF Ant BLUCKSo7F WH”) scaneé (“* 24" Beh); Susitea (cm): $ case ft Ep = Fopen (“Buick gon, txt”, “w)- J PTO For (v= 100000" ('ep90000 ; f= 11 S000) $ generate random (9, Oo; gettime sfdar (at, NULL); Stat = 1 AV. Sect (LUV Leste [10000000 .0)” Brick sora (9,0 1=1)3 Pettimekleg Ht, NULL): end = t.tve see + (t ty_see/ fv 000000); print na ht 2 EWN, fend ~ st077); eprint (ep, “ad bt are In", t, ent otara); t Eclose(Ab)y brent; case. : prieté (“Enter tht nuunser 0F valuas Fo be gowrater’ scant ha" & te Jenerate — ranelom (4,1); qerrimestdoy{ st, NULL); Stara s tety. Seet (tty see 1000000.0); QuicteSovF(9, 0, (-1), Jettimeocday( Rt, NULY; end = totve Sec + (t.tv_usec /(0000000.0)5 priate (hal \t ETE An", ¢, end St979); printeU Sovtedl Number are \n"); pring G THE Sorted r7Aq fs \n"); For (viz 5 9< 6 N44) printe (“yg \t" 999); breck; default! printé (“ Invatigd choice tn"); 4 random 0! an BD From @ given vertex ( a weignted tonnerted Graph, Find Shoraect patho to BtAEH verter using DirstraS alg roth Sot: - Pinctude estdio-n> TEInclude < seidt's.n> TH notes < toniv-4> int mac) Pat Tobl[10} 2, stem, fnteqeree (io), Frag PINES Enter tre unser oF vertex \n)s cant nd”, BV), printe( Enter the numer oF dae matrix"): . Vent arroy(29J (299, v, 3, Wountso+ for([ so; (eve (#4) § for (T=°5 Tev; T+) seanet nd"! & Orre4( iI GI): 5 white (Wount 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 | | void ofc plagD < Cott << C445 fost int 0=%5 coutcc ste FI << “ ''3 3 Cout << ende ; “ Gorution” << e Sit; epements J; AEO* 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 f Ed 0S <> min) ¢ N min > 4057; bens) $ 7! “eCKIG) =u; theI OI = POI; kets Count #t3 cum ex cost tut LUI? sed 2 for( Vz 0; VK, VE) . le( sv E20 BS cost Fe) G7 447) ¢ a7 2 est COI; plyg ats 5 4 for( (20; teas b+ 4) fortdzo; 3= 999) Cout cc {ny Alo Min Cost span tree \n")s e} s€ 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): Factor = UTimeP Times) 100; printey “ Povallel Floyd fs AE perceet time faster than Senal Floyd \n”’, Fa epor); wetum Q; > eS 2 2 —— 4 Eng

You might also like

pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy