Thanks to visit codestin.com
Credit goes to www.scribd.com

0% found this document useful (0 votes)
23 views32 pages

DAA Unit 2 Notes

The document discusses algorithm analysis, focusing on time complexity and the classification of problems into polynomial and non-polynomial categories. It explains concepts such as best case, worst case, and average case scenarios, along with Big O, Omega, and Theta notations for describing algorithm performance. Additionally, it touches on combinatorial problems and the implications of input size on algorithm efficiency.
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)
23 views32 pages

DAA Unit 2 Notes

The document discusses algorithm analysis, focusing on time complexity and the classification of problems into polynomial and non-polynomial categories. It explains concepts such as best case, worst case, and average case scenarios, along with Big O, Omega, and Theta notations for describing algorithm performance. Additionally, it touches on combinatorial problems and the implications of input size on algorithm efficiency.
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/ 32
° DAR By ‘be esc nit 2 Wives | [ ——fownsis of -algeatthns 4 —— — 7 a 7 : = -- _ — _ Mats x mult Pil Gdro — St penentral 2 _ jonapsuu problem fer OpRaA /% 7 [sp Mitng dy nani __faceral nl = Cetra ney pexombri eee Teme ea # ——— eee “Uuen _bautbe Se ee te eI Ee ee apres 7 ie a a aa ata _ Growth Qare — . SS soe as the ee ae oni Sunninn, HH me fncrenses as gq Lineion OL} 1p J ~The sunning. Hime af an algertinm is He incor of an. ifP-Size 9iven. fo a ee Gost, — : “The. cock of avenaen f= pt née p3_— higher Value id pt = ie “are of Gea Bo — A_yawtety of Frowth water Hor gre apcetatind. BGepsesentetive ct Aypial algarthrn ame sno oO Jo 20 30 “0 _ £0 * __ : ap Ste ——consrant Gro r a —Sifis eens procenking 1. face ct dats fleet “Hee Sn Milli, - jot elo a rier ae ee on dade, rapa oF Sun 4 Sachin ove Piece d Piece ee Takeover. - Lr — — — _ a — — Logeritrnrc Geawth rate jo a Gaewdh wale _ a where, the —reesetime raeadeare! puws _____by one Unit each Hrne the _alara IS “dleubled . ct ; - ~ pour. Groat . — T+ is a methemat cal way oF Tepreseni ne __ the _ time complezity.. : a a compare two al gaxitams with wrring times fen) -< Jon), We heed 4 rough. measure tat Characterized Arow Padb — Cach Functon_ woud less we. “puastonanne en — alaontrhon by fakery a_sudtdentty |4r4¢ i}y2 Gize, we Lannasd- JuHFfy ib pel With — Hene we Study ASymppte Sedultt, CE cm thn Grrmace of an n i in bauedlasly : Nfs of Asy m prom c Notetons 1, Began” (a2 : ——- Bi ———— —_ 2, eo . a a tole ob (fo) a _S-_Littte omega Cw) O Nopetion — Asympronc © less Han” aaa fe = OCGin) apres fen) “Sgr! __ 2 yopetrn - _ frsyroptore * Greates Haan” far = yee) pied — O joratton- Asymi a on= ff cea ere doe Fine @ (F.C) pitas pany" 90 Page No. i a i i his noletton 7s denohed _ by | arene - pronounced. ai pg oh". seg. o4 notetton eS th me, ___@etnei ap pat band — fet ne ite ik mean S nning time °F cd godinm Cannot be. mere_-fha FAS OTS — ian bound fe ae ede — lek £24 2 4cn) are two hen-r 30 hon negative Gandia $38 indicating suncing ote two al foxttt ms. . —we Say , Jin) is upper bound cf _ ~ io 28, thet. oxi rs Sore posit re ~ @ = Gen) = C“90n)- eo nen, | 2 oe ie denoted a Fer) = 0 (gm) ) C4 Jt) — 3¢ Jie an uy | ! Tek lead 2 C. upper boun, — oe” oe Len): OG ; : one No _4,—> upper bound. . E j . jy nity oon? + 10m 4 ! = on) a 3B =n? es oC na) Soo 24. : - oo oe nd er, bound. of -yunnin y seme cL |tneg . Sonn oY 7 Een) = 6€n+3 Sole = we have +o find. Co and Me Such shaft O< fond < C9Jmn) Les ay NW, € Fer) < c+ gen) <_6n+ 3B < C¥#gu) < tt 3S Gnt3n Perau ny, cam be Such _intrnite Pagrbilitts) ih 6ut3¢ Gu tes all n>, | So Coq € GonJs 7 by = 9 - Te pul Lp fa ot OS En+3 € CW Gen) Oc Ens SF So Hose marae Eire uk: the _Proyrk he — HeE Se Cate] fo | =r fory= &e3 fo: = OR a oe oe 2) 24 7 27 28 Zs 35 = _ em above teabe we. Can tae a Pen) = oCgen) = 0 (n) = a Ca4 No= 4 = " Pex €=T_ho=3, if 4a S¢ on --- There Gan be multple fart ob €¢, fo). Posribie YA Sind uppx bound of Fin) = 3neonty (2) Big Ores : = “Thfs _potatwn ts denoted. by Vi 4 LS Pronounce ad § R “ — 84 Omega netaton oeDra lower bound Let the. _o4Jorxithm. —= TF means the yunning ime of al geri Carb ee fast ag ee _ASymprstr o n bean ndo at- data _ — ees sen is Jowet bound. of Lon) it there _ SpuSk some _poeitne constant £ C_ and ic — Sach that Og Cg) Sfin) fet a SE ened at — i fn) = 2 gen). a a een eel Fs) C+ Fonz we Aen) _ts_an_ asymptotic loaset bourd ke Fort) - eg: ) Fin A Nowe bound of sunning Hime neat fancion fn) = n+3 Guth Ha Coy we have to fivd Cand Us O< cg) < fu) for a nZNo C. 4tn) < Fen) C:4in) < EnF3 = Gn < Ent+3 -—@® © : os -_ % gnt3 : ___ prbore. bots equality ave pic there. ea SATS aN Siyite eye. | ae a 161 “C= 6€re = C500) = = SL (n) fe C= 5, Mas ___ Sl A a | os Os os fer —s 2) Find lowe. bound af” sunning ee 7 _—— ~guadsady Cee eens eee se Vom r —__ ye awe. > tind C6 and Ma Such Hah . OS €i¢¢n) <= fen) Ge Qi geno : OS GGin) 2G 1 OS (ren) & gn24+257¢ = Oe eine i S Bn*42n4+4 Peau ny } OS n* < 3n?p ani4 Lr all nz) Athove, both. equalities Gee hue, Gnd there exusts Such indinphe prequalitres $6 a = nS = Z z Lek. =3__no=| : - = tenis 2 C40r1) 2 Ge) eo C21, Nox) £0 on ae ower bound. of cunning Hoe of Guadtat ¢_ Lynctron. - fin) = 3, angs. 2-5 et Notation : ad A ent m9 a This pedation Is clenoted. nae Gi __ pronounced. as" §8tq Theta". Tene. __ notatt on det nes _ = ao (fee A — Ib means the - aunnt ng ng dme ch. a. qestthm "_Cannat be teas thar? ov _ae0atee Phan — 14'S asymptodtc ight boand fer a sandom Ang uate JC data, cz 7m 77 A l ony Gout for eke | ! [ag ioe 5 a no n— e Sa ts Haht LEM iL St om: f n pune h Such thar 0 SOF tn) Sfon) § Ca 9th) _ fot Ail ve Yo Tr is denoted as _ Fen= @(4cn)) — 24 = Find 49h bound af scanning dime oe Con Starck Functon fen) = 22- con — we hare. +0 find. Cr, Co and he Sack tha [6 £449 @) Shim $ 6 IG) Rain, OS Gain) $ 23 S @4inr) i O< 22.4) < 23 S$ 24 (1) Fira }— . ae _ 32 — : oe o _Cél, C2) = (22, 24) a -— ‘Gtr ; Wo = a. - r= OC4im) = OCOD fer C= 22, (22249 Meal es tind. eg br hound. of fen)= Cr+3 : Sol" ~ wele have 4e_fpnd Cr, C2, Wg fuhthy OF % JH) S$ LN) S$ Gen Braun 7 6S CG) 2 3G7s S62 9a _. fony = @ Catm)) = Orn) feo Cy >:5 = 7 aS) ee + bound fet me gute Onkyo 3 Little oh ©) => {Big-ch notation may ar sa: poe be Aighd = THisaly called |ovse uppet bound > Little oh js used do defind bound which ts ASym Protea rot ight ay. => Lek “fo & a = athe furans hate : poste we > Ferd Jrows twee than 4(n 4) ~(¢ Limel Lord IF nse gin) ~ famally Gebel as Ring = wl) Mm —_— wD — Brg Omega notedror mey ref or omy rit be : td aa 1§ Wed. to deltne bound whch is cuivenpiel cally not : =e ee ee jp iad a ee wen et ao ag — cn) =z SC) — Eto a Pabynoratal end Non poly nomial paablerns a “Rene are two. categories of algaxtt4 (Prblemt 2 Polynomtal> Problems that arr be Solved a) a polypermatl Hime aed — 8. gene o() ogn) __ Savin acniogn) __Sast.s rg. edting oCmn) 2 Non polypomial Problems LS WW Ch po polynomial dime calgoxttha is _Knowh &4. “Teaveling Sales persion 0(r22”) Knap saa Prien 0 (202). - # Determine a yoninm > Result of every aperiton ?S uniquely, define = g => fora pavttculat iP Computee will Fire always Same output = Can golve Prbkm jn Polyromta temo => Gn dletermine the nestt Shep a _eatecutian_ a x PH WeyS a b+ 3 =¢ FER Same ofp t Now detormini SHC Ajegtor > a ____ = $F Sarre [ QmMpilek pr. ae Arte” a) jn oltfer ted 7 a pe L - Gannot Solve alive Pwblem fa _ Polynompal fe = Canmt determine the next Shp _c& Entecution d due —b more phan oe Per the alfa. Es | Tage No. see [| 1 ef ual de fo 21, ood) See) “Possioi iN Sie to a ic 20 . . = = = 27 Ig = - 34 1g ; ¥ Decision Problem LC oftimiecdion Problem ypeasion Problem > —Any Pobien tes which the answet js eihet Remo ov one (44 ov no) Is called a declsiou. Prop jer? — An_algonthm fe q_ delision Preble! + _tesmed. a cleusion algavithn- 3 optimization problem > — Any Problem thet Involves the iderrtiticction. oebn optimal Ceither, méaot'mun ox rriniun) valua of a diven fancron is IGnown ah an optimization. Problem: - — fn optimi ation algoxthnt 1S Yied 12 Solve: an op mization Prabkem. Decision Problew2 (S Assumed do be easier to L lve Compared. 4to te _ophmizofion problem. +f, bP, NP haed Np havd. Ne com amped; = “Det of P— Prohems that Can he. Catved na_Paenary as ima, (+f Shands f2¢_polynanmial, ag ani Searching, Corvting ete. ee NP = _ sland fox nen- eterrminisnc Polynartd. _ ime. Dis af A Collected OF deer jon Panems thar wan he_- salved by 4 ——— _ non detewmini dC. machine _jtra_pelynertad __time. ce a _ Since detesminin nares Guile the [ alg feda) Gee ON etert roi C orles, w Conclude + 4 that _p & NP» |— Te Ne eb ca problems a oe | sgowszed tnte Np Compkle 4 Mp—har d. Oxablems- . : s rh belong te Clas Wp. Q. Qvesy other peblem Rin Vp can Ie deantfetmed te A in palynsmr af tro - : je. fos eyery PC MP | — BEA : | = Thee 2 Dect Prove tar NP— Complehe = Grapes Gore the hades Prd blems i th_class Np. “They gro aPon arelered 43 o$ MPC, — Mowers a Solution of an ~ Complete 7 Puvblem can he veadlred td _ polynomial Lime 4 Cannel be oblaned jr Palypumial Hie . te a _-» i — -f_ Prbiem ,}8 cated {Ip-camflera jL iar _ Pp vs NP oe - P problen - _ 41. Pp pwbkms are ced of ied whith Can be Solved jn polynomial -fime by detesminishe ajo. p “problems Can be Solved ital pa_polynarjal Anne. pest on Aiflerent ade bed” ¢ € Np fablemhly NP pxtblen. Np Problems qre the Problems which can be Solved. jn non~ detevrini st c Polynormtal Fire. Solution +o Np Problems Canntk be. Solved./ opto fred. in _polynomid tine but jf the %])” is oo can be cf. Np problems. CE p problems: t 4. All Pp Problems are | edasminicte {nA Natur. 6 9. Selectten Sov Linea Search LH! Ne problems %r2 Non- roniSHe in patire Tsp, np psak problem yphacd_ ve Npcompiode “porblems — phar “Np. Complete vt Np hard Problem (cay A) | NP Complete Problems ca, vo Can be Solved. it €anly | be Solved. _detesminith, ~— 16 thera }¢ NP Complete algesthm inl palpnemial ~~ Probie (ay caine Apo - - ereaUbe nie ee Polynomial dima 2 Te_wove Np have Fie_salve 1p @mplere Problem, }- mud ke |Problem it must be tn bp, ta Np class Me £ Me hard Problems - &. Zt is pot : cleastor.| “I+ iS a cleciston . (Py klem | (P20blern ¢ eu pe Detecming yheathet & Jy 1 Lie Prded has q _yno_ ham} Horna “fe Cydle : : 4 Polynomial Problems Reduchon ee a “Te prove whethole pacteulet pwpbiem is NP |, __comyplehe Of Mob wre. ide Polynomial Hr __ sredbehility. “Tay yeicand; fo me TASS and Poe ~C Fd ey ee ——____— : ee a | = => Le ls and_Le be b probes > probien 14 weducos to Le (also walton a4 la a La). if canbe LL thane is 4 way to Solve cig & deter mini uging 4 determinitirc al gontnm Hat Olver ¢ palynomiat me cod gatitie Lo ia Polynomt al time. = This def Impher traf it ue have 4 palynamlaf Aime algodinm Le Le, then we Gan Solve Ly __t Pobynamial ee Le Rephetemis oa Replecerrenf ) Component Destquy AD. Ley Local neplagernent = Tn _dhes ved uthon Ack B__by dives yet A tig the _cfodim et Components And then _sHhese 7 Cony ae be. —_Convesttnd. do components OF ‘Component Design — Tn this wzeduttin AXB — bf building special cempenanl Fie Iyp_ 2 that enditte propeies eq.utned by A. —_l@ap fi = Two poorlen p IL _probleea_ pass Ne= Complete + there fs _polynempd. Hime veduchen ot £2 402 _thenpa {SNP complete, Tage No Dae Hari ltonjan) Cucle | NE ~Shaps ta prove roblen Leis Np-Gmtfe Glep 8 shew cnet Las NP-hel Step 2— An ypebard desisiem problem Lz ( -CO by_eghibiting a polynembal Hime. pon— deteamtmisire al godt fev Lo. How _4e P20ve Problera i Up-hacd Step 2 pick 4 Problem La abeady known be Np- hava: Chp 2 — Show how to obra Cin Polyrom at ated detenrmintit ¢ time) an _fnstane LZ La yante 1 of La Such that _| ee a from the _Solutton—e fr’ wean ——— me (i “ patynommial determin me) —— the Solute do_instance TL of 14 —_ Te - “Step 3 — Gndude far ser (2) that L1qle — a a _ otep_4 — —_Corelude from Steps C22 qnd._(a)ar4— fhe teansrhnty of that Le is — pe pads ee i | — - a _ (asa Pooblero ! oo a ae “Before ths _ whet 13 fabsilabirityle __— let 2, kg == denotsa hockan Vdestables = 5B denote the_negation o£ i. a _— A Literal 58 -eitheeq. Variable ae its nejation p — A formula ia dhe. propositional clad od a patient Ga oe mo : 1S Qind__ gaits oS fetaghton srt, OF —_—_. o = Syrebel yz. denote ax os WT — WE G@rjuchre Narmal ferana)iS am ts a c 2 Cr Vee 7\ (ea Ss) Bi be, ath daute tc | connected = Cats Bubieb Lin P ae Wha onl tie Some adtignmant 26 tt ahd tA a aT Problem 2) : = SxSAT Probert ts the. “problem of an y ee o Sab shabiling- oF a fet CNP fearould — _ each clause [9 tirrhsdh. po Gt mass — a Miterals:— oF oe rs tage Wp, oueT | | SAT is NP—Comple oe — 2) s-saT is Mp: Giren an_assgnment, we — CaN GUE Cheek Hat each Clause IS Covered - — 7 "Dg mri bond 7 To prove tys, @ = reduction fom AT 40 3-SAT midst he _ Provided - A = we wil) Francem each Clause ch, hated on ide angie MO = Redustion CAT }o _3-SAT . “Suppose, ac Ag. Ganteuns J Litemals- Git if Kel — we can add 2 new vartabhes Yd v2 Tal teans feo tis into Ly Clauses: ¢ = 2Vi Ve, 224 Ya Ve,275 LV, v2 2,3 a Vv, pve 244 @ eee ike Keg C G=7z, Zh) We Gn ada : a VAX Able Vo Ze eu Clau fot 7 4, Z1ve4 1% Z 22% “ @) je es Cds 1S, Za, 2.9) “ne — Mave We clause @5 jt js 4) ie (ao : Zz (G= Fz, iz 250 = Can a in K-3 new Vota b2ed = eu Va) and \K-2 dauses: — One of the % mude he te foc the. I9ire) — Clale do be tie. ‘ : __ gee Caun_be-. Seon that fe We atgingl Claw t's Sab Cheble shar its eguivales? 3 AL — MEP risenatior_is Stich, tag: \’ Since any CAT Solution will shige. the 2 sAy Instance anda _3-SAT fon Vangpie, gam 4 car coin the_prablem gre ee — AS 9Ar instane@ an be reduecable to — —3-SAT. so 2¢ar FE also Jp harof = AS ase NPG well Up hacd | $6 we A°—Say that 3%ar ie Np compar | . 5 Sek oe od: Ver hese Cava fot 2 aph ee ee). fo nn Qu edges: in are incident te _at leagh Vertue in S : = The size Isl of the covet fs the yumbet of : Vethces jr_Ss — Ea g Zn _ above ee anifle S= ae SI, » Se» Tee G_Verttet Cover of Cize 3: xo ben 4 a graph Gnd. On ingee K. we are il ae TTheesrt > yetee cee. COVE TS Af CompPiche pam a a Let Gs CUE) and i deg oe nee a Capp: Celigue clectsionr pro lten) a __ 7 fisfume fap IVJan, SS Ss We _cnshuct a oa ae ee eee covet “oF Sze at_méie= PK. [a and_only ;2. G has 4 clipus Oe cs wt lease RK: ; _ cS carol weve” Gold, Curvy Gey, es —_s on re ae ay sea concen ce f : g! ae i obtained. fom & In Polynomial tim, _ Beample. - Gt 4 ch His F oa, G! had Verthore Corer of 5S 3 se Sind! pray edgy cL GI i¢ jneiden esther tthe node 4 ox om, the. ede 5. _ => Thus G has @ Cligue of Gre 5-2 = 3 = Can sisin i pe 7 ts = Since ¢ CHE Satss-febs itty (36AT) a cpr Lo DP A Verster ! cave Se ee Seay heck Ve tae covet 1k alte eae ee = se Nattex caver rs © al. 0 i0_Np- Pecqute we can nendete SII OM Healy chon a tibsef- CLV OF Size K thd Very Pot ial dime thee Cis a Ces o ie ta ~~ Sa Ve teoe Corns if p= complete. = ~~: ;-;-;- _ we CT pate | bari Henian- Cyle. Paoblern i a _ = Hami Henlan Cyche of cu Goat oF a given grapr ___f$_ mound = 401? Path that- 4 at a specif itd» ___VISHS all nodes enecludin one _ Stating node (2 -the ee exactly_once, ard nn at the ae = 2 or pulp a eet pites toon cath € uncbiretted oe vellin bien (TEP, 6 ce cs CEs BAe A CO —-o G With flamitonian Vee G with nO (Glet 34s 1) and, Hormilenear Cycle, 627s 22) __TReorm. > Hamiloaran cyde Mp hare - we Show Sat A pyc. (Directed Hao Tipsy a i z be q prepos) trond Spymula jn Wwe / ye will ensricr a directed Gy ryoh G _ El ee Sea i eee ee eye eee - Cg> BM Vixy Y xa Cas RV Rgveq CBs = = Assume that F hac x clauses - Ga And A Vardbiet 2), %_ Xn. __ = Pau An andy with xt Cours. cat Qn —Llumns: ——— ee — Rw} denotes. “clawia (jo = Each vadubles xt; 1s sef-rsented py, oa _adjucen~ caluron sy Otel ae the | itetal Se) ong ae = oe 2 j=} = hi 5 ac) [oil j il ¢s | @ iT aoe a O Into _wlumn ~: € aw Ca Sts ¢ literal uae Same Paina aes Sich pay cf Columns Xi Grd Wy — iatwodure tuo Vethros U; and Vy, oe ef a fy! at boom. [| ryt Chains ck edge. on a i = ae aTS7 eee a) man Gn otha © i he mney L217) =m Noul drawl gos

You might also like