I'm trying to figure out what is the time complexity of the following for-loop case.
double n; //n > 0 and a real number
for(double i=1; i<n; i*=(1+(1/n))){//some O(1) statements};
I argued with my professor that the time complexity is still O(log n). But he says it's not so I'm confused. In for(double i=1; i<n; i*=2){//some O(1) statements};
, the time complexity is indeed O(log n). Why isn't the former the same? Please help.
Aucun commentaire:
Enregistrer un commentaire