What is the runtime of this program
- by grebwerd
I was wondering what the run time of this small program would be?
#include <stdio.h>
int main(int argc, char* argv[]) {
int i;
int j;
int inputSize;
int sum = 0;
if(argc == 1)
inputSize = 16;
else
inputSize = atoi(argv[i]);
for(i = 1; i <= inputSize; i++){
for(j = i; j < inputSize; j *=2 ){
printf("The value of sum is %d\n",++sum);
}
}
}
n
S floor(log n - log (n-i)) = ?
i =1
and that each summation would be the floor value between log(n) - log(n-i).
Would the run time be n log n?