If we have an array of Interger values, find out a sub array
which has a maximum value of the array and start and end
positions of the array..The sub array must be contiguious.
Take the start add to be 4000.

For Ex if we have an array arr[] =
{-1,-2,-5,9,4,3,-6,8,7,6,5,-3}

here the sub array of max would be
{8,7,6,5} coz the sum of max contiguous array is 8+7+6+5 =
26.The start and end position is 4014(8) and 4020(5).

Answer Posted / monica

Well this is not an answer to the question but the solution
given in the example is wrong. Wont the subarray that gives
the max sum be {9,4,3,-6,8,7,6,5} whose sum is 36???

Is This Answer Correct ?    8 Yes 0 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

Can we increase size of array in c?

695


What is variable initialization and why is it important?

814


What is the difference between declaring a variable and defining a variable?

922


What are types of structure?

803


Explain what are linked list?

786






What are the types of pointers?

766


An arrangement of information in memory in such a way that it can be easily accessed and processed by a programming language a) string b) data structure c) pointers d) array

877


What is use of pointer?

764


What is the meaning of typedef struct in c?

787


write a C program:There is a mobile keypad with numbers 0-9 and alphabets on it. Take input 0f 7 keys and then form a word from the alphabets present on the keys.

15428


Is it better to use malloc() or calloc()?

821


What are the 3 types of structures?

750


Explain how many levels deep can include files be nested?

796


What are enums in c?

825


int i[2], j; int *pi;i[0] = 1; i[1] = 5; pi = i; j = *pi + 1 + *(pi + 1)Value of j after execution of the above statements will be a) 7 b) 6 c) 4 d) pointer

832