Question

Given the tuple (list, value):

$$\left(\left[x_1, x_2, \cdots x_n\right], y\right)$$

You may choose two adjacent values in the list to modify the tuple as:

$$\left(\left[x_1, x_2, \cdots x_{i-1}, (x_i + x_{i+1}), x_{i+2} \cdots x_n\right], y + x_{i} + x_{i+1}\right)$$

Iterate until:

$$\left(\left[\sum_i x_i\right], y + z\right)$$

What is the optimal set of choices that minimizes $z$?

Intuitively, you never want to operate on the largest number in the list. But the largest number in this list changes as you add values together. In other words, the optimal solution is not necessarily obtained by an optimal solution of a sub-problem.

A greedy solution would start by taking the smallest number in this list and adding it to the smaller of its adjacent numbers. This solution, while close, is not equivalent to the value returned by brute force search. This points to the fact the some locally optimal step is not globally optimal, which could be connected to the fact that the largest element of the list changes as values are added together.

No correct solution

Licensed under: CC-BY-SA with attribution
Not affiliated with cs.stackexchange
scroll top