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

DA Problems

problems on ADA module 1

Uploaded by

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

DA Problems

problems on ADA module 1

Uploaded by

suneetha prabhu
Copyright
© © All Rights Reserved
Available Formats
Download as PDF or read online on Scribd
You are on page 1/ 10
Mi Metheonaifal alae _of Nuwe. Hoste | -tgeritten — 2) Based on 4/0 sti, dutde the vartlous _pancenstins 4 be oe —___considmed. Ee & —2)_Teunitfy the “ boats operations” of algoritim. 2)_Compils the mo; of Himes the baste _oprn ext. 4) Obtcin the dotal no. of Himes a bash obrn t enittid « —D)_Stnplify seg Stordancd formula. $ womputi +f _ordan of { pal — Mox. of n chkmeits 5) Ps atso%_ ame = NOH )ent) . 2n3 e& Algortiim Max (A'Lo---. 4) je: An axray of weal “nos AL le mt). ofe s Volue of Lasgust uunett ia A. man pes Max < ale]. 10] 20 [ 30 [xo] oJ for 2-4 4 n-1 do fivst este mon to 1 tf ALi] > max ‘eavay max< ali], sditum Max ‘ Amalaol : 2) The algortdin eienda om tf Aine. ‘m'. 4) “There osu 2 opser_: (2) Anstgnment > habbers only ence. (b) Contparks?on —> happens Por alk value off mr’ 2) An Loop & exeutich -1 Hees, Ha compariston happens m2 tines - a Ne. of Hes = Dee) ieee ede = nevi. Tin) = elm) © o& Algortihn Matidemut Calg, et) TJp : mxn mabiius Pond B. i 3 _OlP Susur mati c= AB: i for t-0 4 n-4 do t alg for j£o. de m-1 do 7 : chjleo ia - i 7 for heo + n-! do 7 f ctijleelijls able leg ai}: ‘} L eutum C. oe : a (a AsldleHon = happens ise mo. ft Honst Oy +_La) Multiptzeation -- mote _mo._of fun (0 Baste open), fl : ont. (The ae 2 obrn dperds gn nt Sea bua + value A ky jand 7 rps Bina 0st JT, tt Obbuc Lindt = Lower Watt +4 Se — we de 7 , : € — nev eS = = = n,. — fa Jeo — =n > Sa =. nn = Ltn-o+r) ) + oy ten 7 = aan => no Ss = mm [(ns-047)] = — id : - = ne . = 1 T(n) = 0 (ns), 7 = —- = 3) Onigueness Proprem - = : - sient Unique Fa( Co--- nt) =a WAC) Re EBB tle: = assed Afoereemst “Ole: ow folse. for PEO. + N-2 do Poy Fetes to m-l do. i if alil=-a (ji gut FALSE vutim Rue - Analysis é £) An alge deri on Ve stu ‘u': > "Compariiion" He baste opin. | 3) The alge. Aiperde ow nt, he Mh dapeade om fla position , 40 we will aun He worhteare, tual | all comparisons. n-2 m- ] TO wir irs = n=e— pet f-2 — tt) 2 2 yas ate): & Cln-) Ua) ra] | ____ {ny Ss a) 5 I Tim) = (ani) 4 G2) s (mes) +. : 3+2+1r 0 4 eee eee) = mtn) , nt 2) Boned en Sfp sixe , womidet - wvosttous paramdiew. | 2] Taeotiiy_ the baste orn. eS | Leo Obtain “the no. of Hime : baste. _obta te te executed. 7) Obtafn seunrene sulation with abbropriat bore condition. 2) Solve Ate suumena sulation & obtaby th ord of growth _ + — Fadtorial of AN + _— Town of Hano? : 4 — Bin supresentation of cledmol on > Fibonaws Sota. 4) Finping we Facrorint_or N_? Factoxfal (CN) f/p : non-neqabive tntegute ofP : value of Nf % n==0 suturn 4. else, sotum F(n-1)an; 4) The le Sin tm 2) Mulliptcclfon” % “the bastu_opyn 3) The total no. of mulltplteation puiformed eon be obtained a. tot Tl) be the mo. of mulithltcalions sneqitred for fant. Flr) 4 FO): &(n-4) eu” 2} in 4 2d Tin): t(n-2) +1 ">0 ie TO)= 0° MEO Non eh wubthE cations co — when “EO pt = 3 = = oy — Seige _ 3 ai 7 = i 2 @) = 7 T (m-2)42 : = = T (nem) 4m. = Tlo)+m an Ltt) =05 +1 Tin). O(n) 2» Tinving Buwary Reeetsentation : Algrtthn Bin(n) fp: +e decimal, dnteqoe OP + Binoy sebrestntalton. B= 1010 ; | ome4 ‘a : EM satin 6 Ooms epenye ehse @ ads) +4 : Bin (Led) 44 @ 8 Gd ; a(lA)),,E At: OS ere 2) he 4/p_ ste & ims. = fo. _2) Baste opr % dféaten, - £ 2b rin) _be the mo. of divtsfon suquirud tor */P m- a Tn) = 1h) +1 and ThI=0 fF nes = Concidua n> ok. = t= tCA)sa = = sh): T gh) + 4, ae Tite )ee 2 ee ied 4 = ae 2 ip Gsk-B) aiken pm eh oS + soit (3%ue kip or 2 1 er dat : TU) +k oe sate © yO oo Ue) peer ae Th): : _= ee ee an * Kt) = = 3) Fibonacct Sorts i The noe to the sequin, rt 0,4,1,2,3,5, 815,21, The Prat roo moe | Atgort#tin, Fetonatek Come “Sie: Non- n ve tntegin coe oP: the nth en mo. Masa sidum 4. else véem & (n-i)+ € (n-2) 2) “The 4p stu aw 9) Bast obrn % addftion 2) Th) be no. of addétfen waged Tn) = ine) + +(n-2) Tl O Thea *4 Tn): tla-r)s t(n-2) > Te 0 chanactudstic cop Mes - Ct VEG) f Eveay . = Ass Ten) et (Ft C7 rtin)s 6 Ol gn) 4) “Tower of Hanoi 2 The probum %& +o Lrarvfes a chs fuom Sous +o dy.tinatten. Powus s : : @) TWonfu n-1 db trom _¢ + teh. (6). Tuanfn wh ate from sd. (2) Tranfr n-1 die from + + ob, | Die or Mews aaa S om, att Algor?thm + of (nt, te eS urbor ode we kup a ow a) | OJP» moving disk to the dustfraton. Constdon tims. tomunofshanot bn.s, tT) tthe: 8f (mee a) (= Mm move diski Prom stod ne a a —_beoworot hanot (m-4,6,4,¢) move disk n from std. | tose - of hanot (n-a, 4, dat Dod fa) = Analyst, : D The no. 4 mows o& Hme suquined udipouls on no. a4 dels ys, 2th bast oprn ts movement Bf discs. Th) be the mo. of moves _vequtreds = =) = TO) = T(n-1)4 44 T(n-4) i TW) = ot(n-a)4a Tea & TW)=O *. Tins atl) 4. cha Aca CE ay 8" T(n-n) sat rae2 yo torsos Wr Eg aM! sare 4 otros Tlo)- 0 1 (a"_) Gp - alms) a-4 a Mea. = a4 +s Tn) = 8 (a)

You might also like