Question: Suppose that we have a sequence a 1 ,a 2 ,...,a n that we wish to memorize. We memorize it by computing partial sums of

Suppose that we have a sequence a1,a2,...,an that we wish to memorize. We memorize it by computing partial sums of the forms ai + ... + aj. Let us say that the cost of memorizing a particular integer a is |a|. The goal is to use the minimum cost to remember the partial sums so that we can reconstruct the original seqeunce. For example, if (a1,a2,a3,a4) = (1,3,2,4), one of the possible solution is to memorize:

a1 = 1

a2 + a3 = 1

a2 + a3 + a4 = 3

a3 = 2

The total cost is |1| + | 1| + |3| + |2| = 7, and a1,a2,a3,a4 can be reconstructed by using Gaussian elimination from the information memorized.

Give an algorithm that computes the minimum cost to memorize a sequence a1,a2,...,an. The algorithm should be polynomial in n. (The minimum cost of the example above is 6.) (Hint: MST).

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!