Download as pdf
Download as pdf
You are on page 1of 14
[ sxavva B00KS: Algorithm Desion and Analysis _ FIRST TERM EXAMINATION FIFTH SEMES%ER [B.Tech.], September, 2016 gorithm Design and Analysis (ETCS-301) Maximum Marks © 30 Time : 1.30 hours Note: 1. Attempt three questions in total 2.Q.No. 1 is compulsory. Attempt any two more question from the remaining, Question 1. (a) Distinguish between O(Big Oh) and o(litle Oh) notations. (6) Define subtract and conquer master theorem. (0) Prove that (n+a)* = O(n"). (@ Explain Overlappin subproblems. (e) What Overlapping subproblems. Solution: (a) A little-o bound is a stronger condition than a big-O bound Big-O is an upper bound. f(x) is O(g(x)) if Ww)i1 = ewhen n<= 1 Here ln) = O(0t4) Therefore, Tn) = aT(n-b) + O(n#) when n>l ‘Now to find order of complexity for this ki i Nowtfndordeofconpexy fr this der tela relation we can use subtract Tin) = 07) if a<1 Mn") if a= | aoe \r4a"1b) if a> is is very helpful for finding orde i i form Tn) = ate-b)fn) Generally on ena helpful for this kind of recurrence. phthalate (€) Refer to Question 1(d) of First Term 2011. (€) Refer to Question 5(a) of End Term 2015, ia a ll 1 Solve the following recurrence relations (a) Tin)=T(n/3) + T(2W/3) + (using recursion tree) (0) T(npm4T(n/2) + 03 (using master method) (©) Tin)=27(Lw/2.1) +2 (using substitution method) (0 Tim {Irwstyee Foot (using iteration mehtod) Solution: n)_ (2m @ TM) 1(Z}+7(2) +n ; n L Tacs 8 n, c ee re Bs rf 7) m, a 2S | “\ “~\ fy % } T(n) = Cost at each level * Height = n*(logyntl ("3") = O(n logan) n » T= ar(Z}en a= 4,b=2fn=e Wty = ft = phonyQ)? = 2 a in) = reesere which satisfies case III of master method, and it also satisfy regularity condition- ratysis | [Lesuva pons: Alportn Desi and Aner —_= of) -e0(§) 4-2" < Chr) forall C2 Hence Tin) = Ow?) To) 21(2) +m ‘Step | : Assume a solution T(n) = O(n log») Tin) $ Cm log n for all m2 |" biog|” Step I: Tin)s 2 c[)x[S] + ‘As ‘n’ is very large, hence n_[n 7Ll 52g tn s Colog5 +n S$ Calogn-l)+n

You might also like