Greatest subsequential sum: Difference between revisions

Content added Content deleted
m (→‎{{header|Sidef}}: modified code to work with Sidef 2.10)
Line 1,557: Line 1,557:
for(`x',xmax,ymax,`get(`a',x) ')</lang>
for(`x',xmax,ymax,`get(`a',x) ')</lang>


=={{header|Mathematica}}==
=={{header|Mathematica}} / {{header|Wolfram Language}}==
===Method 1===
===Method 1===
First we define 2 functions, one that gives all possibles subsequences (as a list of lists of indices) for a particular length. Then another extract those indices adds them up and looks for the largest sum.
First we define 2 functions, one that gives all possibles subsequences (as a list of lists of indices) for a particular length. Then another extract those indices adds them up and looks for the largest sum.