Recursion Schemes for Dynamic Programming
نویسندگان
چکیده
Dynamic programming is an algorithm design technique, which allows to improve efficiency by avoiding re-computation of identical subtasks. We present a new recursion combinator, dynamorphism, which captures the dynamic programming recursion pattern with memoization and identify some simple conditions when functions defined by structured general recursion can be redefined as a dynamorphism. The applicability of the new recursion combinator is demonstrated on classical dynamic programming algorithms: Fibonacci numbers, binary partitions, edit distance and longest common subsequence.
منابع مشابه
Unifying Recursion Schemes
Folds over inductive datatypes are well understood and widely used. In their plain form, they are quite restricted; but many disparate generalisations have been proposed that enjoy similar calculational benefits. There have also been attempts to unify the various generalisations: two prominent such unifications are the ‘recursion schemes from comonads’ of Uustalu, Vene and Pardo, and our own ‘a...
متن کاملMulti-Predicate Induction Schemes for Mutual Recursion
Where mutually recursive data types are used in programming languages, etc., mutually recursive functions are usually required. Mutually recursive functions are also quite common for non-mutually recursive types. Reasoning about recursive functions requires some form of mathematical induction but there have been difficulties in adapting induction methods for simple recursion to the mutually rec...
متن کاملNotes on Dynamic Programming Algorithms & Data Structures
The technique of Dynamic Programming (DP) could be described “recursion turned upside-down”. However, it is not usually used as an alternative to recursion. Rather, dynamic programming is used (if possible) for cases when a recurrence for an algorithmic problem will not run in polynomial-time if it is implemented recursively. So in fact Dynamic Programming is a morepowerful technique than basic...
متن کاملConstructing Logic Programs with Higher-Order Predicates
This paper proposes a logic programming approach based on the application of a system of higher-order predicates put at disposal within ordinary logic programming languages such as prolog. These higher-order predicates parallel the higher-order functionals or combinators which form an established part of contemporary functional programming methodology. The suggested toolbox of higher-order pred...
متن کاملTowards Tree Automata-based Success Types
Error detection facilities for dynamic languages are often based on unit testing. Thus, the advantage of rapid prototyping and flexibility must be weighed against cumbersome and time consuming test suite development. Lindahl and Sagonas’ success typings provide a means of static must-fail detection in Erlang. Due to the constraintbased nature of the approach, some errors involving nested tuples...
متن کامل