LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Newbie (https://www.linuxquestions.org/questions/linux-newbie-8/)
-   -   how to find the time complexity ? (https://www.linuxquestions.org/questions/linux-newbie-8/how-to-find-the-time-complexity-4175440467/)

rpittala 12-07-2012 11:43 AM

how to find the time complexity ?
 
Hi ,

how to find the time complexity of an algorithem and when to consider the O(n) O(n2).... and O(logn) O(n log n)...

Please provide some need full docs or links (url) to understand.
FYI,

I have googled for it found some information. But, not able to figure it out.

Thanks & Regards,
rpittala.

markush 12-07-2012 12:03 PM

Here is an article in wikipedia http://en.wikipedia.org/wiki/Time_complexity

I would recommend that you try to understand the subject and then when you have further questions, use the Report-button at your posting and ask a Moderator to move this thread to the "Programming" forum.

Markus

linosaurusroot 12-07-2012 12:29 PM

Quote:

Originally Posted by rpittala (Post 4844683)
time complexity of an algorithem and when to consider the O(n) O(n2).... and O(logn) O(n log n)...


MIT Opencourseware includes the 600 course that I can recommend.
http://ocw.mit.edu/courses/electrica...ideo-lectures/

Adickel 12-07-2012 08:42 PM

Its not always simple
 
To find the complexity of an algorithm can't be done with simple commands or testing the algorithm without understanding the test case and how the algorithm operates. If you were to submit a case of n objects to the algorithm it processes them in "n" time. If you increase this by 2 then it processes in 2N time. The only true way to figure out the complexity is to look at the code. Loops where every "object" that the algorithm is processed is an O(n). You can look for nested loops, if for every object, all n objects are processed, you have an O(n^2). Its very complex and hard to explain, you might want to read the Wikipedia article in full.


All times are GMT -5. The time now is 06:23 PM.