I have written a program in C to solve the maximum sub-array problem. This solution is of O(N^3) complexity. Is there any way to approximate the run time for N = 1,000,000? I know there are much faster algorithms than that of third order but I need to compare those to my current program.
int MaxSubSlow(){
int max_so_far = 0,i,j,k,temp_sum;
for(j=1;j<N;j++){
for(k=j;k<N;k++){
temp_sum = 0;
for(i=j;i<k;i++){
temp_sum += A[i];
}
if(temp_sum > max_so_far){
max_so_far = temp_sum;
}
}
}
return max_so_far;
}