»
Bottom-up: Builds an array of partial results that aggregate into a com-
plete solution
»
Top-down: Splits the problem into subproblems, starting from the complete
solution (this approach is typical of recursive algorithms) and using memoization
(defined in the next section) to avoid repeating computations more than once
Typically, the top-down approach is more computationally efficient because it
generates only the subproblems necessary for the complete solution. The bottom-
up approach is more explorative and, using trial and error, often obtains partial
302
PART 5
Do'stlaringiz bilan baham: |