5 Replies Latest reply: Nov 18, 2007 8:06 AM by 807600

# Could someone help me with arrays & recursion??

Hi, I'm new here and I'm having trouble.

I have to write a java application which uses recursion to find the maximal contiguous sum in a list of integers.

The input is read from a text file where each line represents a list containing the following integers:

For example, it might contain

7 -2 -4 30 15 -7 -5 1000
2 -50 100
6 1000 -2000 900 2800 -2900 2801
4 100 -10 5 8
4 100 -50 5 8

And for the output, for each line of data read, I have to display the largest sum of consecutive integers in the list followed by the list itself. For example for the lists above, my output would be:

(on the left side is the largest sum of consecutive integers and on the right is the list of integers)

1033
• ###### 1. Re: Could someone help me with arrays & recursion??
Please don't double post. Since this is the smaller post, let's consider this one dead.

• ###### 2. Re: Could someone help me with arrays & recursion??
I'm sorry about that. I didn't mean to double post. I accidently clicked "post" before I finished typing.
• ###### 3. Re: Could someone help me with arrays & recursion??
R.S. wrote:
Hi, I'm new here and I'm having trouble.

I have to write a java application which uses recursion to find the maximal contiguous sum in a list of integers.

The input is read from a text file where each line represents a list containing the following integers:

For example, it might contain

7 -2 -4 30 15 -7 -5 1000
2 -50 100
6 1000 -2000 900 2800 -2900 2801
4 100 -10 5 8
4 100 -50 5 8

And for the output, for each line of data read, I have to display the largest sum of consecutive integers in the list followed by the list itself. For example for the lists above, my output would be:

(on the left side is the largest sum of consecutive integers and on the right is the list of integers)

1033
Where did this 1033 come from? Could you explain your problem in a bit more detail and also post what you have done so far and explain where you are stuck: only posting the problem description sound a bit like "can some one do it for me", it's better to ask a specific question here.