Traveldixie
Programmer
Table t[1...n]
int s, i;
i=1;
s=0;
while(i<=n){
s = s + t;
i++;
};
Complexity : is it n+2 or 2n+2 ?
At the
the line s = s + t;
isn't the adding of t a simple constant assignment?
Or am I traversing the whole table still making it an extra "n"-factor?
Please help us out here coz we're disagreeing
Thank you!
int s, i;
i=1;
s=0;
while(i<=n){
s = s + t;
i++;
};
Complexity : is it n+2 or 2n+2 ?
At the
the line s = s + t;
isn't the adding of t a simple constant assignment?
Or am I traversing the whole table still making it an extra "n"-factor?
Please help us out here coz we're disagreeing
Thank you!