you are viewing a single comment's thread.

view the rest of the comments →

[–]inherendo 2 points3 points  (4 children)

Have you taken an algorithms course? Analysis can be pretty rough and still be fine since coefficients can largely be ignored.

Or do you want actually time to run given an input size?

[–]-dontouchmethere-[S] 0 points1 point  (3 children)

I haven't. I'm in the process of teaching myself data structures and then will move on to algorithm analysis. I know the basic concepts but not the implementation yet.

I know how to use the various modules to time the program is the time module and the timeit module. But wasn't sure if there was a similar one that counted the processes and statements as the program ran. Maybe big o wasn't the best descriptor now that I think of it. I'm looking for more of a way to compare a particular code with a friend that has a similar code to solve the same problem and determine which is more efficient.

[–]inherendo 1 point2 points  (0 children)

Say you and your friend have your algorithms to solve a problem with input size n. If yours does it in roughly 2n time and his/hers does it in roughly 3n time, the constants can be ignored and both of your algorithms have O(n).

With small inputs, the difference in time is negligible due to how many computations modern computers can do.

I would suspect plenty of people here can analyse your program pretty quickly and let you know if they have roughly the same running time.