Time complexity of algorithm

Please support our Computer Science advertiser: Learn about neural networks and artificial intelligence.
Reply

Join Date: Jun 2005
Posts: 2,052
Reputation: Rashakil Fol is just really nice Rashakil Fol is just really nice Rashakil Fol is just really nice Rashakil Fol is just really nice 
Solved Threads: 139
Team Colleague
Rashakil Fol's Avatar
Rashakil Fol Rashakil Fol is offline Offline
Super Senior Demiposter

Re: Time complexity of algorithm

 
4
  #21
Jan 8th, 2006
The way I explained is the simple way; a complete answer takes only one sentence. "Count the number of fundamental operations that take place" is much simpler and less nerdy than any complicated description about iteration counts and nested loops.
All my posts may be redistributed under the GNU Free Documentation License.
Reply With Quote Quick reply to this message  
Join Date: Aug 2005
Posts: 29
Reputation: vartotojas is an unknown quantity at this point 
Solved Threads: 0
vartotojas vartotojas is offline Offline
Light Poster

Re: Time complexity of algorithm

 
0
  #22
Jan 26th, 2006
I am looking on how to measure in terms of either seconds or milliseconds of the runtime of an algorithm with real data, i.e. of a program.

What would be the best implementation of this? This would either be for C or C++.

However, what I am looking for example, is something similar along the lines of how one would get a script execution time (render time), in a typical PHP program. You all have seen at the bottom of forums or other PHP based web pages and have seen that calculation. Would this be one way to implement this?

How would I implement such without using too many system dependent libraries (e.g. windows), but rather either a custom or by standard libraries?

Any thoughts? At first I thought, before calling that algorithm function, say myTestFunction(), I would make a system call to request the time, then after the function has completed it's run and returned to the original call position, to make the system call again and then do a simple subtraction somehow on the time then that would be the result. Of course, I could just be dreaming this all as I have yet to fully investigate this, but is this how it would be done?

Any other ways?

Thanks
Reply With Quote Quick reply to this message  
Join Date: Sep 2006
Posts: 5
Reputation: nagarjuna is an unknown quantity at this point 
Solved Threads: 0
nagarjuna nagarjuna is offline Offline
Newbie Poster

Re: Time complexity of algorithm

 
0
  #23
Sep 23rd, 2006
U can calculate time complexity of an alg using foll steps.
1.Recursive alg
Form a recursive relation of the alg and solve the relation
2. Non recursive ralation
find no. of times the stmt r executed
For deatiled explanation refer Analysis and design of alg by Anany Levitin
Reply With Quote Quick reply to this message  
Join Date: Oct 2006
Posts: 2
Reputation: arshad mohammed is an unknown quantity at this point 
Solved Threads: 0
arshad mohammed arshad mohammed is offline Offline
Newbie Poster

Re: Time complexity of algorithm

 
0
  #24
Oct 11th, 2006
i want to ask some questions,how con i do that?
Reply With Quote Quick reply to this message  
Join Date: Oct 2006
Posts: 4
Reputation: navaraj is an unknown quantity at this point 
Solved Threads: 0
navaraj navaraj is offline Offline
Newbie Poster

Re: Time complexity of algorithm

 
0
  #25
Oct 23rd, 2006
can you please tell me how did u come to the conclusion it is a average case ? is average case = best case ??
Reply With Quote Quick reply to this message  
Join Date: Oct 2006
Posts: 4
Reputation: navaraj is an unknown quantity at this point 
Solved Threads: 0
navaraj navaraj is offline Offline
Newbie Poster

Re: Time complexity of algorithm

 
0
  #26
Oct 23rd, 2006
can somebody give me an example for exponential time complexity ???
in the previous i saw the example for everything except exponential one !!

Thanks for the good explanation !! good job. ;-)
Reply With Quote Quick reply to this message  
Join Date: Oct 2006
Posts: 4
Reputation: navaraj is an unknown quantity at this point 
Solved Threads: 0
navaraj navaraj is offline Offline
Newbie Poster

Re: Time complexity of algorithm

 
0
  #27
Oct 23rd, 2006
"So to answer your question: A function or an algorithm's runtime can be depicted by different theta expressions. However, these are equal theta expressions. Remember that Theta(n^2) refers to the set of all functions that grow at the same pace as n^2. Well, Theta(2 * n^2) refers to exactly the same set! (If a function grows at the same pace as n^2, then it also grows at the same pace as 2*n^2.)"

my question is ,

is it only for theta ? or it can applied to Oh and Omega also ??
Reply With Quote Quick reply to this message  
Join Date: Mar 2007
Posts: 1
Reputation: jagadisha is an unknown quantity at this point 
Solved Threads: 0
jagadisha jagadisha is offline Offline
Newbie Poster

Re: Time complexity of algorithm

 
0
  #28
Mar 3rd, 2007
Originally Posted by Narue View Post
O notation removes all constants so that you're left with the largest growth rate, which will be dominant as N increases. Naturally, when N is small, the constants will be the dominant factor, so it can make sense to keep them in the equation rather than removing them if N is guaranteed to be small.

>I know the complexity for the above will be O(n^2) for very large n but what about very small n?
It will still be O(n^2), but if n is 5, for example, 100n totally dominates the algorithm as opposed to if n is 5000, where n^2 dominates.
find big-Oh noyation forf(n)=n+log n
Reply With Quote Quick reply to this message  
Join Date: Mar 2007
Posts: 9
Reputation: fahimarif is an unknown quantity at this point 
Solved Threads: 1
fahimarif fahimarif is offline Offline
Newbie Poster

Re: Time complexity of algorithm

 
0
  #29
Mar 7th, 2007
Hi ! I read all dicussion about time complexity on this page. Please tell me if there is a lengthy programm that too written in c++, how I can calculate its time complexity.:mad:

Is there some software which can do this job automatically ?

Fahim
Reply With Quote Quick reply to this message  
Join Date: Jun 2005
Posts: 2,052
Reputation: Rashakil Fol is just really nice Rashakil Fol is just really nice Rashakil Fol is just really nice Rashakil Fol is just really nice 
Solved Threads: 139
Team Colleague
Rashakil Fol's Avatar
Rashakil Fol Rashakil Fol is offline Offline
Super Senior Demiposter

Re: Time complexity of algorithm

 
1
  #30
Mar 7th, 2007
You find the time complexity for big programs the same way you find it for small programs.

There is no software that can do this automatically.
All my posts may be redistributed under the GNU Free Documentation License.
Reply With Quote Quick reply to this message  
Reply

Tags
algorithm, algorithms

Message:



Similar Threads
Other Threads in the Computer Science Forum
Thread Tools Search this Thread



Tag cloud for algorithm, algorithms
About Us | Contact Us | Advertise | DaniWeb | Acceptable Use Policy | RSS Feed

©2003 - 2009 DaniWeb® LLC