| | |
Time complexity of algorithm
Please support our Computer Science advertiser: Learn about neural networks and artificial intelligence.
![]() |
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.
•
•
Join Date: Aug 2005
Posts: 29
Reputation:
Solved Threads: 0
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
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
•
•
Join Date: Oct 2006
Posts: 4
Reputation:
Solved Threads: 0
"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 ??
my question is ,
is it only for theta ? or it can applied to Oh and Omega also ??
•
•
Join Date: Mar 2007
Posts: 1
Reputation:
Solved Threads: 0
•
•
•
•
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.
![]() |
Similar Threads
- calculate time complexity of the algorithm (Computer Science)
- time complexity of algorithm (Computer Science)
- Calculating time complexity (Computer Science)
- Help On Time Complexity Algorithm (Computer Science)
Other Threads in the Computer Science Forum
- Previous Thread: Breakthrough heralds new era of cognitive computing
- Next Thread: Help me figure out what drivers do..
| Thread Tools | Search this Thread |
Tag cloud for algorithm, algorithms







