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

DAA-Module 1 (Part 2)

Uploaded by

Janhvi Singh
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)
29 views18 pages

DAA-Module 1 (Part 2)

Uploaded by

Janhvi Singh
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
| Since the nos gq Bore the Comperisor Dill be exenuec/e lis lange. than the no + Q repebhionn 4 the Loop's books hy exacth |, [the choice i¢ rot thal Impowtont ° | Wwe an allernale uny Compub’rs the nog Bren the Loop & execuel » | Steve the value qn *% about halveelon each vepebition the Loop, the anuver Shoules he about Genrewd plan per anahiyging Hme eSBerence J rom weeursive algs. | ts Deciole on a paramete. inckicoling an Tp's Sze & Iderbhy Lhe a's ante openckion |B loheci whethe, Lhe he- @ Brno the bonte opeoltor ts executed! alepencl only on the ie 4) ar Tp: | If + ahe aleperch om Sone adlkional Properly the \Qask case, Average Core, if necessary best care efictency have [tbe ‘nveligaled Zeparabely « Le Gk Up the urn expressing Be hoy bres the algorithm's | | [baste operalion is execulect | | 5: Wing Starclevel porrnules and rules g Aum manipulation, [ether find 0 closed own fomnufan or the count ov at the Nery Aeut, establish th orcler a qfewth » u HW) Sd sda. 41 © uta (Luare integon Pts, f Su)e |. eel ey Us i bine, % WMS " a 1@ 5 27 - 14 tay a4..m 2 Nn) 4,2 a a iD dy 2 2 UR 4 Re Mow) (ani 13 = eee a ge my é a s. rk oy | 20 Fay ee! Kat n ; i 6 Zo aig, tan. my a ~ —— (a4); | -l hh. eS ee gu, fo a] Zaye | 2 "d= Iaasarg, ne (na 4a | 4. 2) 2 -t4ah ar 2 * oy 1 RUn ns, when a 00-5772 . (Euber's constan "+ 2 Sgr ws a 7 hag uy u "2 cas= 8a; fp is, , | au 4 u #18 Carter) = 6 ara Sb; tp fed ih 4 m u 3) Zas - 2 a;4 Sas thew Lemdu vg rk Feagy 4 Mel S (Qr-a,y) - Au ay ff B Compute the factorial pe flm=n) fox on arbibary ren Megabive integer Dict... (aayn e-yen for rZI Co) fe rsh sty Compute F(m)=F(n-1). 1 orth the Piecoing Tecurstve algorithon Ag pln) 4 =o relure J ehe Yelm floa)en Recurmrece velalion Min) = K(m4} for noo \ bocemp, g fo mafkply pln-) bg 2 tn) M(o)=0 Min)eu (n-144 Use Sabthhlben medaeol_, A by n=1 Ph G-ayajt) PA(n-ad4a Me Intbrat Aolubon, =M(n-1)4/ Bien b gh nba daly = HK(h-n)in *M(e)4in €0(nr) ?: Tower a Honor: n okie. 4 Lfferent 2tzes ard 3 pegs 10) | Move alt lhe econd one disla lo the thir pe tring tne a On aurian Move only one olish al o Kime ik iS forbiollen Lo place a Aarne, olttk on lop of a Brnalle. one | MOm) =H tnd bIdM (n-t) por nt 6 AM (m1) 4) Tribal coneliion M(1)= J M(n) = gus (n-1)4) ~ afan(n-aysiai > a? M(n-ad 404) : a [am (nays Jrar 2M (n-3)+ 2% 2H) Pain (ni 4a yah? yay, = aly (n-daaht Obtarn Min) bg Aubsbitibing nen-- Inikal conclion apeeMed Jos m=), achiewo! for f=n-) Miny- a? ny (n(n) 1a] ~ a Mays ans, any gmt) 7g?) € 0 (a) Th $s the most efficient aly. fox Uus problem 1 is the [Problem's inbainsic ab‘MReally Wot mato, it So computationally here Exponenkal alge dun por an tnimaginably fang hime even pF Modirate values hom 3+ Find Ue nos 4 binary ckigls Yn the binary repraentalion ge [Pasttue aera tntogen | 5, bina ree ) 4] M1 yelurn | ebe reluon binaribec ( L% J) 4) Recurrence relakon Alayza (inj, 3) +4) fever AC)=0 ental concthon fmf 0 Gs . tlh y olhewwise Feoy-14 Ang) =H ROPES ) said (rhe) “3110 a) | Mb (%') | 22m, 274401) ain | ~~ : log 9 = L059 fir) =L05 oa a fete € 6 (esp) O Generad Plan fv Sroblssng Kime ef Betency 4 Recursive aby. impli T pis 8 I Deciole on a povomeler tnoticobing an Tp's Size a. Idenkhy the aitgowhrn’s baste opeotin 7 ws 3. Whether the no- a, bn tre bovte opecton execubed Can Vary on AfBrenl Alps | tL care ABriency roual be Ihe Some Size , corrse Ipvedgaledt Cove, average Core, ber $ eparaleny 1 1@ Ae Sed ep a yeewrence relakon with an approprode trated Condition av the roe @ Hemen the beste operalton t executes. S+ Solve the rect¥vence ov atleart arcervlarn the Orolo. 9 Greoth Qh its Sdlubon. ee porkant problem bypes: Sokegs Rearvenge bre items qo g- fst loclal por Seoxching ( dcboraria, belephore bool) Some alerts are belle then othen, there *< ho algorithm that would be lhe bet Bdlubin in alk Situabon Some 4 dhe Algeysth ons are Aimple but rveotively low Gdhile others are fiarte. but move Compiler Some Wosk better on vondombuy bvolorvel Ips while ?o aacercling oroles . Others do belles 0 almnast Amteol Lists: Some are Suitable only fry Lbs vesicling in lhe fart memory chile dlhers Can be aolaptecl for Aorbing Large file Alored on a oltsle Two properties 4 Aovbing algonthro )» Stabe & 7m place Stable ~ it preserve lhe elements in 1b T)p- implace — if ik doe nol require esha memory ercepl yellabive ovder Q ang 2 equal Possibly pow a few memory wnihe | Searching» preting @ gr Value calle A Aeorch Lo OO Qn. sel - (ov a mmathisel which perevts Several) elements te have the tome Value) . es Ainge algorithm Urat ils all sibuotiorn host. Some als work farter than bthers bul vequie more memory, Some ave Vew Jart hat applcable Only to Sorteot arayy. Ther #6 ho Stabilrhy Problem, bude different iis es aries. In appl Whee he arrelor Lying cola may Chonga Preguentig Yelalve bo the nop %, Bearches , Aeorching han bo be Consilerso! fn Corjuncton with & Other Operakors - aolelbion to ano cleletion prom the colada sek J, an ttern- ee Rescesstey : A string a Sequence charaders pom an alphabet + Strings of Particular intereart are ext Alvings Which Comprte Jetbexs, numbers Ard Apectal characters, bib String, Culvch Comprsse Zeros anal Oren Gr genre Sqquerd, Whech con be rmocleloa by Abrings 9 Characters from the pow Chevaclen adphabel Sa.cery Skring rratching fsa eae) jor a gr word th a Lex Boph Problerns : Graph, a a collecbon 4 points callocl Vevhco, , Aome 4 Which are Connected by Lire Aegrent calleel eelgey, y yy Graph con be Wed fox moolebng a Wile Vonre ty 2 OF r¢09 Lhe apabienkon , including bromportaton, ancl Communiakion hehoore, Projed Achedulling and garrer Banic qYaph Leorvthm ~ Graph Lraversel ~Abeortest path : boyoolegical Sovking per Graphs wilh dvecteol edger. Some Gaph pwhlern av Computetionally very had (1p, Hoph co loving Problem) TSP ~ circuit bead, visy chip fabricabon, x.¥ Chreptallegraphes ancl Jenekic engineering , Youle Plarraing Graph Coloring — aslo Us bo arstin the Armallut nurnbken % Colows bo Verbee 44 gap So that ho bwo Aohacent Verbees aw the Aame color- Event Acheduling, *f the events axe representrel by Verbce, Phat arn connected by an eolge +P anol Onke, Pf the Comterponding Events Conn he Achedluleo! in the Kame Line. @ Aolution bw the Yaph Celoring problem yielon an opbinat Acheclute » Cormbihe bid Pabjerrs} Thae axe Problem that ark Cexpricrtty ov tmp)rcil P Peale daar bo fra A Combinatorial object, Buch OA Permutation, a Combinattor, Or a Subset tol salteler Ceslain constrainks arf hon Avme clastred Praperly ( marin’ ze, @ Vale oy mintntzps a ast), TSP and raph, Cobring Problem ore examples g Combinatorial problem, - Geometyse Problems} a Feemelwi¢ alg clead cvtth geomelarc objerts reich a1 Ports , rey Grel Polyaona . Problerns a corshicing Almple gpomelrs« Shage,, briorg tos, Markel ruler anol a Compous + Ppp). - Computer graphier ,rebobiog Numerical problems? CNdey Gothen Gn Pre problerss thal involve mathemabital chyeok Z Conbhuan natare - Solving eauabions ana Ayler J eaabons Compubing obpinite inleguals Pvatuching fr majority 4 the malherobial Problern can be Aolveo! only Approsimatdy 7 arene a Stra ctuvert Date. Structures Can be ckfired ar a Parkiculon Scheme 4 organizing related data ibems. Rinceo dake Sbiuctuner: Bray ard Linked Ll 94- Is a Aequence 4 7 tte B the Kame date hype thak are ghyveok Conka ously tn Compules memory Grol maole Actersible by A Peeling & Value 4 dhe annay's tndlex. Arve, =) | Noked Lst- 2s a Ae quene m Be ov moe elemah calle! efi poder ach containing we lirala op [infors dake and Prk. Usk - 13 @ Pride sequence 4 olaka thers | | Two Apecal hyper 3 Lists — Stark ard querer- | | hack - Ig a ksk tn which ‘nteKor ard olor can | be dene only ot dhe end (hp). LiF Que Isa bist from which ment are olleledl from One end Q the Abuctun C prod Gro new ekrmenk ae | be dhe otter end ( rear) «FIED. Pee Queue %s a collecton % Cele themr from a brtally ovdleres Universe « oporalion 9 priorh, queue One Prding ke Peceont elemenl-, dlehing 5 Langerd olument ard delle a@ new dement. Gx | rformally, ax a coMedton Y, Prints tn the plane callect Verbices ov neler Some 3 ‘edhps wv anes. | Forrnableg Beg B=C wets ts defined ly a pat oy 2 eb, O pintle Bot Vo thers callgh Veticen arola Sek 2g pie gy tee ibeorm callcl Gey, them Connectrel by Line Fegmenk callenl Ly Tt. o o © ion Unol-recteo! Joph oltrecleot ov cragh Complete — 9 Gpaph cotth ove pair a its VeWes Connecheck y ae edge : Denye — A graph corde veLalively jew possthre eolqmn lssing | Spame— A Graph cote few olga, refalve by the rere 4 ib Vereen: Graph Tepresentalons' 1+ adjacency erabix | 2 adjacence, fests: ie ke ga ———!2_Which The element In the i row ene dhe ee alume iS ecual be | if there tsan eels. fons 1% Ventex bo. Ube 7% _Verlex J —__ Ihe ts po a be Calge -9.0graph, With Dp vertices. boolean matrix with ore sow ane! oh Loe And esualto Oo if | —_| i marx in. ye 7 As alesay Aymmebsc PLind= ALi _ Gh cedie J _ a@al|oo!l1oa0 | bl o.o T oo7 - clT T 6 0 TO “ab r o- 0 0-tO6 i flo o | 1 oo] - tlo 1 0 0 10 4 Aeljaven 4 dh 9a va oli 5 2_ealection Ly x vertex thal very i bo _the = List! Vvenlex. - aloc—d i> abe en => eo (St sd ar A= sabe : i | eh ers ya b's Apone, the adj ocer last aera we us pate (han Bre Conreponding ads reals dirptte Lhe erbo, oer chad palo a the Bo hiod Mish s- a Lweighbea graph = 12.0. graph tu eee - . +{asegeae_in fb edo, + These rusrohors ane cabled ahs or Cosbs : — —P_pode_fporn Veber to Venter ay 0 Graph : G__Can be cep a i Make thet Alot i = oak i ve. uy all / Verba _4 a path an dikret, the path is Aad b > he. Binge « The engl 9 6 pole is Ge tplal number Vedices fm Be. 2 &y Poth virus bh 9% dts D we ' eee nee ___Dsteo) pee. to the Vertex Lise) nexb - - )is_Said bb be Commected! if for | J | ee Seer j ~~ .B_Cyele is a polh 4.0 pasilive Lang Ws —+t thot Aloals “ara engls -ak_ the Seme Vertex are! — dew nek—Frevane te aoe eclge more than ance - — 2 graph asin eyele ae eee ee oe @ ©, © _ eo ? oa i] C—B O_o aj : ald [vee Fo xesl | | : | 7 _The fag eclges ta breo ts aluays Naess tos Uae Hie prises oy cks Vadis { LE\ = |vl =I Rooteol bas = fer eve. hao Ver bea, tng bee, thew adoays — exted Wy Ne Sinple path rom one 4 these Voiee “bn ane othe “TRE property malas fh passe by Sebed an arbi ‘dang Vettes fa frute.trer ane! constles ~W as the week Gg. the 0 calle! xooltel Lee. fay dng Verte tra ion a atk we J Nevitee an Lhe Style path — fom. the -%oad ods thee Mertex caltce/ fncetnns 1 (4a) is the al alg 3 the fe the reel Lo Verbs ie a bee oh abe %sthe & —~—| ____ Co by. level ating cut 10 fox the yeet's souel, the alep ty 7-2 ver lex - Lf ts SF tls f » é jht_'s the _ fi tk Verbeces + — dered _becs — An pyclensol_Lres #2 0 vechea/ | bree fo whe alt bby childyen. 4-€0.ch Verker He _Oreleexel - | Bir, 4 bee = An ordered bree te which OVeny = vertex has ne mare Uhan bun Chilelaen anf : Gach child ¢ clertgrralecl Qn_eithes a Left chile | 42g hk Hilal 29 16 Parenk - |The tubbres tatlh the anak ab Hoo ble | chit ld 46 Vertex ts calleol the hie Sublree Q ee eee fang earch trees — A _humber Asse, _ __| Soch_porentel Vertex ts aageo than alt te ~—|Murabers in th ft subbree ard Smalls. han. = alt the numbers in jh Vght_ Subloecs + _ unc / fal Pek © ——Syacific el ts ckfineo!_b | b if d LD explert Lisling 2 sts element - S543 2 Sperthye prapelg lat al the set's elec” tng thy mat sabe | os Fn of apie mumbo and Dewy __Hutkse = An tnprolerid collection a ‘terns Unt | Gre nak necersansi ede - Seb pera Kore - cherletoa Poero bership 4, a ge-thera fo. 0_gn-_2et = —tinfoa gy feb ___inhev.secton g-a_Sets ICE) & a Spee aah

You might also like