But sure.
Lets give it another try, then. There is an existing function L(i, j) that gives me the length Li + Li+1 + ... + Lj. Here's the pseudo-code. (comparison: =, assignment: <-)
ALGORITHM MinCost(i, j)
// Recursively computes the minimum cost of this cutting-problem.
// Input: Which subproblem to handle: from final log i to j
// Output: The minimum cost for that subproblem
if i = j
return 0
minC = MinCost(i+1, j)
for x <- i+1 to j-1 do
if MinCost(i, x) + MinCost(x+1, j) < minC
minC <- MinCost(i, x) + MinCost(x+1, j)
return L(i, j) + minC
How's that? Still not sure how to proceed from here, though. Even though I've never actually written this down, I've gone over it a couple of times in my head. |