Time a function: Difference between revisions

m
→‎Example: fix typo
(added task; and Python example)
 
m (→‎Example: fix typo)
Line 40:
>>> print map(lambda n: str(usec(qsort, (range(n),))), range(10))
['2.7', '2.8', '31.4', '38.1', '58.0', '76.2', '100.5', '130.0', '149.3', '180.0']
where ''qsort()'' implemented on [[Quicksort]] page. Timings show that the implementation of ''qsort()'' has quadratic dependence on timesequence length ''N'' for already sorted sequences (instead of ''O(N*log(N))'' onin average).
Anonymous user