Content deleted Content added
m Undid revision 584014749 by 65.26.196.38 (talk) revert good faith edit |
Tag: repeating characters |
||
Line 47:
* ''[[Top-down and bottom-up design|Bottom-up approach]]'': Once we formulate the solution to a problem recursively as in terms of its subproblems, we can try reformulating the problem in a bottom-up fashion: try solving the subproblems first and use their solutions to build-on and arrive at solutions to bigger subproblems. This is also usually done in a tabular form by iteratively generating solutions to bigger and bigger subproblems by using the solutions to small subproblems. For example, if we already know the values of ''F''<sub>41</sub> and ''F''<sub>40</sub>, we can directly calculate the value of ''F''<sub>42</sub>.
Some [[programming language]]s can automatically [[memoization|memoize]] the result of a function call with a particular set of arguments, in order to speed up [[call-by-name]] evaluation (this mechanism is referred to as ''[[call-by-need]]''). Some languages make it possible portably (e.g. [[Scheme (programming language)|Scheme]], [[Common Lisp]] or [[Perl]]), some need special extensions (e.g. [[C++]], see<ref>[http://www.apl.jhu.edu/~paulmac/c++-memoization.html Automated Memoization in C]. Apl.jhu.edu (1998-08-21). Retrieved on 2013-08-10.</ref>). Some languages have automatic [[memoization]] <!-- still not a typo for "memor-" --> built in, such as tabled [[Prolog]] and [[J (programming language)|J]], which supports memoization with the ''M.'' adverb.<ref>{{cite web|title=M. Memo|url=http://www.jsoftware.com/help/dictionary/dmcapdot.htm|work=J Vocabulary|publisher=J Software|accessdate=28 October 2011}}</ref> In any case, this is only possible for a [[referential transparency (computer science)|referentially transparent]] function.[poiuytresmnbvcxzm,nbv
== Example: Mathematical optimization ==
|