Given the finite sequence a1, a2, ..., an of integers (which can be negative or positive), its segment is defined as ai, ..... aj for i> = 1 and j <= n. I am trying to create an algorithm that can find the minimum sum of all segments, in other words, for each of the possible segments that can be made from a sequence, summarize their respective terms and make a set consisting of each sum received. To try to make this clearer if sum_a is the sum of segment a1 and sum_b is the sum of a1, a2, etc. For all possible segments, then from all the sums that I get, what would the pseudocode find the minimum sum of all sums of segments?
In particular, how can I find the minimum positive amount?
source
share