Saturday, January 31, 2015

Dynamic Programming Chinese translation of dynamic programming, dynamic programming similar to Divi


Dynamic Programming Chinese translation of dynamic programming, dynamic programming similar to Divide and Conquer, the answer to a question dependent on sub-problems, the best solution to solve common problems. Divide and Conquer and different places that make more use of the mechanism of dynamic aneuploidy programming memoization will answer questions dealt with child record, aneuploidy to avoid double counting, so when overlapping sub-problems should use dynamic programming; aneuploidy Divide and Conquer usually handed back (Top-Down) to deal with, turn into iterative method (Bottom-up) is not easy to solve, so the use of dynamic programming aneuploidy can solve repeated recursively compute and retain the advantages of thinking.
As previously mentioned in the article Divide and conquer, will repeat the calculation of yellow and green part, and use dynamic programming written as follows: var map // cache of fibonacci function Fibonacci (n) var value = map [n] if value == null if n == 0 value = 0 else if n == 1 value = 1 else value = Fibonacci (n - 1) + Fibonacci (n - 2) map [n] = value return value
The results will be because of the Cache data without having to calculate the green part, it will not be handed aneuploidy back down, and achieve the purpose of enhancing performance. Alternatively, you can directly to the n = 0 and n = 1 prior information into the Cache: var map // cache of fibonacci map [0] = 0 map [1] = 1 function Fibonacci (n) if map [n] = = null map [n] = Fibonacci (n - 1) + Fibonacci (n - 2) return map [n]
emn178 published in the ruffian off state PIXNET Comments (0) Trackbacks (0) Popularity aneuploidy ()
Popular article featured in January 2015 (4) 2014 1998 (1) August 2014 (2) June 2014 (1) January 2014 (1) December 2013 (1) November 2013 (1) 2013 nine May (2) August 2013 (2), April 2013 (5) March 2013 (4) February 2013 (2) January 2013 (6) December 2012 (4) November aneuploidy 2012 (11) 2012 ten month (3) August 2012 (10) May 2012 (1) 2012 1999 (9) 2012 1999 (11) February aneuploidy 2012 (3) January 2012 (1) December 2011 (3) 2011 eleven month (5) October aneuploidy 2011 (3) 2011 1998 (3) 2011 August (10) July 2011 (2) 2010 1998 (1) August 2010 (1) May 2010 (4) 2010 1999 ( 5)


No comments:

Post a Comment