You are on page 1of 2
O} Show thot the computing function oF OBST ;4 Sol- For d<—1 to n-\ do | Home Assigament —2 '-#* 2100080125 ott) ? | | for t<-1 to n-d do Seiad minual <— @ For Kk ei ts ido minua Minual — ct} Sum e— su cli, a) <— minual+ Sum WetUD eli nq eR © Time compleidy & cry) > O(n) The Principle of optimality does not hoid for ever Proliem Lohose So\uiion MY be Viewed as bhe res -Uld OF O Sequence of decision. Find 4+Wwo Probie For whith the Principe does not hod. Explain) why the Principle doess'\ hoid for these Prowiems. 2100080115 sat “he Probie = reo ge Nol hotd the Principle G). O]r Knapsack. ci). OBST. o/t KnaPpsacK |~ | = ol Kaapsack Probitnn Conrad be solved by the greedy method because tt iS Enabied to Fill the KmaPsack Prabum +6 Find jeapacity: So, heve Greedy aiqovithen ts nod Optimal Ahen ofe\ KroPsack i$ also Not | | OPHima\ OBST “- optimal binary search the time required +0 search a node in + AS more than +he baianced binary search 4¥ 1S « contoinee batamced binary search tre Levels than lesser number oF

You might also like