Search:

Type: Posts; User: custurd122000

Search: Search took 0.31 seconds.

  1. Re: MaxSum algorithm with negative values in Array

    You were right, i inputted the algorithm incorrectly...now the data file in case 2 is still posting incorrectly, heres the updated algorithm


    {
    public static int maxSum(int[] a, int n)
    ...
  2. Re: MaxSum algorithm with negative values in Array

    I'm not supposed to change that algorithm, I can only change the case statements that call upon it
  3. Re: MaxSum algorithm with negative values in Array

    No you were correct it should be 1 but its printing out 7, the code just prints out the sum you had the correct idea but when adding negatives it warps the result into a strange result
  4. Re: MaxSum algorithm with negative values in Array

    In theory yes it should but the result of that is actually 7??? I have no clue where the numbers are coming from but
    1,2,3,4,5,6 prints out 21
  5. Re: MaxSum algorithm with negative values in Array

    The maxSum is given the problem is the implementation of it but what it is is basically an algorithm that prints out the sum of the
    integer array. It works as is but it won't let me input negative...
  6. MaxSum algorithm with negative values in Array

    How would I go about inputting the negative values in the array in case 1 the array comes from the user, case 2 from the text file?
    The sum prints perfectly fine with positive values but if I input...
Results 1 to 6 of 6