|
-
November 7th, 2008, 08:37 AM
#1
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;
}
-
November 7th, 2008, 09:25 AM
#2
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?????
TheCPUWizard is a registered trademark, all rights reserved. (If this post was helpful, please RATE it!)
2008, 2009,2010
In theory, there is no difference between theory and practice; in practice there is.
* Join the fight, refuse to respond to posts that contain code outside of [code] ... [/code] tags. See here for instructions 
* How NOT to post a question here
* Of course you read this carefully before you posted
* Need homework help? Read this first
-
November 10th, 2008, 04:43 PM
#3
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.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|