lundi 29 décembre 2014

Is it wise to verify runtime complexity of code with timer tests?

Is it wise to verify runtime complexity of code with timer tests?


For example:



x=very large input;

timer start;
foo(x);
timer end;

print time;


So if the time was 0 seconds then that means foo runs on O(n) or less and if timer is say 30-60 seconds, that means the runtime has to be larger than O(n)?


In general, does more time a function takes then that means it's runtime complexity is larger?


Aucun commentaire:

Enregistrer un commentaire