A memoized function remembers the results corresponding to some set of specific

A memoized function remembers the results

This preview shows page 82 - 90 out of 90 pages.

A memoized function "remembers" the results corresponding to some set of specific inputs. Subsequent calls with remembered inputs return the remembered result rather than recalculating it, thus eliminating the primary cost of a call with given parameters from all but the first call made to the function with those parameters. A function can only be memoized if it is referentially transparent; that is, only if calling the function has the exact same effect as replacing that function call with its return value. (Special case exceptions to this restriction exist, however.) While related to lookup tables, since memoization often uses such tables in its implementation, memoization populates its cache of results transparently on the fly, as needed, rather than in advance. COMP 6651 / Fall 2013 - B. Jaumard 58
Image of page 82
. . . . . . . . . . Dynamic Prog. . . . . . . . . . . . . . . . . Assembly-Line Scheduling . . . . . . . . . . . . . . Knapsack Pb . . . . . . . . . Shortest Path . . . . . . . . . . . . . . . . . . Longest Common Subseq. . . . Conclusions Memoization Algorithm COMP 6651 / Fall 2013 - B. Jaumard 59
Image of page 83
. . . . . . . . . . Dynamic Prog. . . . . . . . . . . . . . . . . Assembly-Line Scheduling . . . . . . . . . . . . . . Knapsack Pb . . . . . . . . . Shortest Path . . . . . . . . . . . . . . . . . . Longest Common Subseq. . . . Conclusions Dynamic Programming Algorithm COMP 6651 / Fall 2013 - B. Jaumard 60
Image of page 84
. . . . . . . . . . Dynamic Prog. . . . . . . . . . . . . . . . . Assembly-Line Scheduling . . . . . . . . . . . . . . Knapsack Pb . . . . . . . . . Shortest Path . . . . . . . . . . . . . . . . . . Longest Common Subseq. . . . Conclusions Dynamic Programming Algorithm COMP 6651 / Fall 2013 - B. Jaumard 61
Image of page 85
. . . . . . . . . . Dynamic Prog. . . . . . . . . . . . . . . . . Assembly-Line Scheduling . . . . . . . . . . . . . . Knapsack Pb . . . . . . . . . Shortest Path . . . . . . . . . . . . . . . . . . Longest Common Subseq. . . . Conclusions Dynamic Programming Algorithm COMP 6651 / Fall 2013 - B. Jaumard 62
Image of page 86
. . . . . . . . . . Dynamic Prog. . . . . . . . . . . . . . . . . Assembly-Line Scheduling . . . . . . . . . . . . . . Knapsack Pb . . . . . . . . . Shortest Path . . . . . . . . . . . . . . . . . . Longest Common Subseq. . . . Conclusions Dynamic Programming Algorithm COMP 6651 / Fall 2013 - B. Jaumard 63
Image of page 87
. . . . . . . . . . Dynamic Prog. . . . . . . . . . . . . . . . . Assembly-Line Scheduling . . . . . . . . . . . . . . Knapsack Pb . . . . . . . . . Shortest Path . . . . . . . . . . . . . . . . . . Longest Common Subseq. . . . Conclusions Conclusions on the Dynamic Programming Technique Applies to a problem that at first seems to require a lot of time (possibly exponential), provided we have: Simple subproblems : the subproblems can be defined in terms of a few variables, such as j , k , l , m , and so on. Subproblem optimality : the global optimum value can be defined in terms of optimal subproblems Subproblem overlap : the subproblems are not independent, but instead they overlap (hence, should be constructed bottom-up). COMP 6651 / Fall 2013 - B. Jaumard 64
Image of page 88
. . . . . . . . . . Dynamic Prog. . . . . . . . . . . . . . . . . Assembly-Line Scheduling . . . . . . . . . . . . . . Knapsack Pb . . . . . . . . . Shortest Path . . . . . . . . . . . . . . . . . . Longest Common Subseq. . . . Conclusions References Assembly-line scheduling & Longest common subsequence T.H. Cormen, C.E. Leiserson, R.L. Rivest, and C. Stein, Introduction to Algorithms , Second Edition, 2001, Chapter 15, Sections 15.1 and 15.4. Knapsack Problem U. Manber, Introduction to Algorithms - A Creative Approach , Addison-Wesley, 1989, Chapter 5, Section 5.10. COMP 6651 / Fall 2013 - B. Jaumard 65
Image of page 89
. . . . . . . . . . Dynamic Prog. . . . . . . . . . . . . . . . . Assembly-Line Scheduling . . . . . . . . . . . . . . Knapsack Pb . . . . . . . . . Shortest Path . . . . . . . . . . . . . . . . . . Longest Common Subseq. . . . Conclusions Suggested Exercises Course Pack: Exercises 9.1, 9.6 and 9.8.
Image of page 90

You've reached the end of your free preview.

Want to read all 90 pages?

What students are saying

  • Left Quote Icon

    As a current student on this bumpy collegiate pathway, I stumbled upon Course Hero, where I can find study resources for nearly all my courses, get online help from tutors 24/7, and even share my old projects, papers, and lecture notes with other students.

    Student Picture

    Kiran Temple University Fox School of Business ‘17, Course Hero Intern

  • Left Quote Icon

    I cannot even describe how much Course Hero helped me this summer. It’s truly become something I can always rely on and help me. In the end, I was not only able to survive summer classes, but I was able to thrive thanks to Course Hero.

    Student Picture

    Dana University of Pennsylvania ‘17, Course Hero Intern

  • Left Quote Icon

    The ability to access any university’s resources through Course Hero proved invaluable in my case. I was behind on Tulane coursework and actually used UCLA’s materials to help me move forward and get everything together on time.

    Student Picture

    Jill Tulane University ‘16, Course Hero Intern

Stuck? We have tutors online 24/7 who can help you get unstuck.
A+ icon
Ask Expert Tutors You can ask You can ask You can ask (will expire )
Answers in as fast as 15 minutes