logo

COMP3821 - Extended Algorithms and Programming Techniques

   

Added on  2021-05-28

3 Pages1258 Words39 Views
COMP3821 Assignment 3Jinming Dong(z5211275)May 4, 202011.1O(2n)1.21.2.1recursioninitial M [0, · · · , n] ←⊥ to store the value of cut-rod(P,n)memoized − cut − rod(P, n)· · · if M [n] 6= then· · · · · · return M[n]· · · if n=0 then· · · · · · q ← 0· · · else· · · · · · q ← −∞· · · · · · for i=1 to n do· · · · · · · · · q ← max(q, P [i] + memoized − cut − rod(P, n − i))· · · M [n] ← q· · · return M[n]1.2.2Iterationmemoized − cut − rod(P, n)· · · let M [0, · · · , n] to store the value of cut-rod(P,n)· · · M[0] =0· · · for i=1 to n do· · · · · · M [i] ← −∞· · · · · · for j=1 to i do· · · · · · · · · M [i] ← max(q, P [j] + M [i − j])· · · return M[n]1This study source was downloaded by 100000822526728 from CourseHero.com on 03-31-2021 06:46:33 GMT -05:00https://www.coursehero.com/file/70008931/a3pdf/ThisstudyresourcewassharedviaCourseHero.com
COMP3821 - Extended Algorithms and Programming Techniques_1

End of preview

Want to access all the pages? Upload your documents or become a member.

Related Documents
COMP3821 Extended Algorithms and Programming Techniques
|5
|2703
|54

Academic Skills - Assignment PDF
|8
|2284
|38

Desklib - Online Library for Study Material
|207
|16045
|382

Cryptography Tutorial with Examples and Exercises - Desklib
|20
|3498
|416

Cryptography Assignment | Doc
|6
|741
|19

Computer Information System Assignment
|7
|654
|379