Question: int[] input= {31, -41, 59, 26, -53, 58, 97, -93, -23, 84} public static void findeMaxTeilsumme1(int []input) { int curStart = 0; int curEnd =
int[] input= {31, -41, 59, 26, -53, 58, 97, -93, -23, 84}
public static void findeMaxTeilsumme1(int []input) {
int curStart = 0;
int curEnd = input.length;
int curSum = Integer.MIN_VALUE;
System.out.println(curSum+" "+curStart+" "+curEnd);
for(int i= 0; i< input.length; i++) {
for(int j= i; j< input.length; j++) {
int tmpSum= 0;
for(int k= i; k<=j ; i++) {
tmpSum+= input[k];
}
if(tmpSum > curSum) {
curSum = tmpSum;
curStart= i;
curEnd= j;
}
}
}
}
Implement a routine that calculates a list of equally distributed random numbers in the range [-1000, 1000] for a given parameter n.
Use this functionality to test the algorithm with larger amounts of data. How does the runtime behave for rising n (Measurement with currentTimeMillis ())? Create a small list of appropriate values.
Note: Use Math.random () to generate the random numbers in [0, 1], which you then convert to [-1000, 1000].
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
