-
Time Complexity
i have a c++ code here. Plz assisst me that if i want to calculate its time complexity considering it as an algorithm. How can i do that? What would be its time complexity?
#include<iostream>
#include<stdlib.h>
using namespace std;
int main(){
int i, j, n;
for(i=0;i<n; i++){
for(j=0; j<n; j++){
cout<<"my time complexity is = "<<i*j<<endl;
}
cout<<"complexity is increasing"<<j<<endl;
}
system("pause");
return 0;
}
-
Re: Time Complexity
Sounds like a homework assignment.....
Did you read the "Why We DONT do Homework FAQ????"
What reference book are you using to learn about time complexity?????
What do YOU think is the answer??? And WHY?????
-
Re: Time Complexity
The time complexity has to do with the critical opeations being performed. In your program the critcal operations are being execurted in the for loops. I am only getting you started. Like others have said, if you want to learn, you need to do your homework.