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

DAA 3rd

DAA assignment 3

Uploaded by

ghanashyamkadam1
Copyright
© © All Rights Reserved
Available Formats
Download as PDF or read online on Scribd
0% found this document useful (0 votes)
13 views

DAA 3rd

DAA assignment 3

Uploaded by

ghanashyamkadam1
Copyright
© © All Rights Reserved
Available Formats
Download as PDF or read online on Scribd
You are on page 1/ 13
H Assignment No % 03 Test pace peu mevinganeacaamtseata advantages __—|-and__disadvantagec? tustify with_an_ example that -tne_shortes the original large + oben _ =. Dynamic _prograrming Works _9n the Following principles: __ . Characterize -+the Structure pF the optional Solunon ve = | Dynamic programming is used +b Solve optimization penbleras 1 Make a change problem 2. Koagsack problem. S Ortimal binary seauhtree S-_ Ai) pair shor 6: Assemby fine scheduling: 4- Travelling salesman problem ___ ee yblem. —~ 7. Muli - S¢nge tage graph problem a Advantages | Disadvantages. kL optim: ; . : | ; Subptoblems optimally and. combining thera 2 Scio. NF i ) ; A B ol 1 sf ie vil i i i Esubproblems,DP avoids __|_and_itrieving —intermncdiale Which can An icant potential abFecting pesinir 0 Feduce tine comple xi} 2. Greneral App liability: DPcan 3. ComplexityiA implementa _ ss i ipa of a opticaizaion derision -naking |__OF subpmblems 4 their dep and nore. dencies i ——4_/Easy4 40 Modiry: One a __} _4-Non = trivial base Case __— DP soluikion is implemented Tdentitivatinn : Identifying the 14. (Oo often be easily correc base cases can be + Mooditied for related Challenging and {s _crucla\ — |-prnbleens forthe coved eunciioang DP algorithm. — | classmate. [The puinciple oF Optimality Stakes that an_optinnal_solutin. | 9 a_piobl etn chains —bphena)_spluiens 40 its subproblems Inthe (ootext of _ the shores path —pimblera 5 this_pria tiple | means that if a shores Lr’ + path fmm point A +0_paink C goes through point B , then tne path From A 40 B aod the path [| cron 8 40 c caush alin he the cha ese paths_heheeen —_ = || sea. stnpse respective points. Example Consider a graph with verties A,@ and ¢ and edges With Weights as Foiloils: «A 7B:3 * A-C+1l0 «Bee Tb find the Shores path From Ato 6, wie can consider 2 =e di 2 the paths A B Cond A—?C dirediy 2 ____ ns ane AB) 4218-70 = + Path AW? 6 has a weight OF $a. __________ The_shpeesth pact trom Asoc is AWBOC With a total eight of S- wa i 7 We o' + The path from B4o c is park bE the shorlest path A+oc the benveen their espe rive poind.. Which codisties the principle o¢ optimally. S ———- ‘explain_in_brier et _to_dynanaic programming explain in PriéF-the "tal g eis elses oe ies eee explain why itis _advaminges to yy > wigs ip 4—-dynamic—prograraming solves each sung nilemn nie & sharet — __—_ the solution. This way, if + ‘ b se be || | ll i \ voi | redundant work —Tn_summany 5 dyoamic progratmming leverages npsirmal I i i i ions Ss | Jems. H oF expensiv e -——__» ; Space-Time Trade =o6F! White _membizahon_may idcreare | “pate_compleaity due do the sorage of Subprobien teeant 7 the equation in time complexity oFlen* outweigh’ tne, -—— Gdditiona) spare cast , raking it —O_wlotthwthite trade op) any casec, a a lemenied using o. hash table + 4ne_s. Obiem Hers and the value iS the sult OF the subprde f + Feonsidering previous eas rmance. abba 2h Use _o.40p=—dorin Gppradch » a sp. down (With men pieat do) ____|___making choles a4 each step }Opproach to boulld up ____|___+inat seem pest at the Solutions 40 _subproblem< ___|__mpmnen de | and combine them. 7 roore CF ecrent terms oF time, but may not t Npmia| time Complexity. On _+he ae | | a — Dri! 5 vit i to odi | Matrix Chain Ach Hy bieckon gebicm 4 Muntipli asiOn Fravhena! Krapsatk pyabket ; = nal reconsidered 0 find he optima! spluson | by Combining “the solutions of | 3 Subproblerns - ~ Suitable For problemas Where Suitable for problems where devisions at each dep based - ' a O global Optiraum WiYnout | on solutions #0 _subprofolens Considering other options. i SoluhOry = _Poes not always ra an optinaaL Sauaions id depends _ the problem has. optinnal || substructure and_overlapying Oo the problem having the greedy. choive property ee . Some ti. donnie 0s £60. fa or. ies (1) he binomial _coesticient at Sg Cink) = nt Kiln -k)! 'dpCdLlyy! wwii soe 2.| Gi) _the DP -+able a 0 Fit | cperecient ¢(n.k) rh + that provides the most @Ffilient way oF searching oF elements. In a inary search ‘tree the average cos oF hi th Frequency OF searches for tach €lement The goal oF an OBST is +p minimine tne expected Cosh 9& Searches by 1 Chaasing the Optimal drrangement oF nodes. | key concepts: The elemends tn he Stored in +h rE haw associaked Frequencies Hepresenting the \ikelinpod pF _aciessing each Kew (Ost ca\culation ° “The _cost of searching for a Key is_pimporhiangl +04 depth Of the Key in the tye multiplied by its beequentd (Om A ‘binary Search -trte that the—htelg hieg : gnode Frequeauy aq, a ‘ SS pea. sqrel! i °. Ra NZGQhHOn probkem With 4 give ue without +ota\ vi nd 4 aximum vdlué vi Cg! 2 be included jn jhe enapsart lillie lnssmate i i c ¥ de + ica | example : (Consider he following items and a knapsack _

You might also like