What i am trying to do is to time a specific array using a sorting algorithm. What i have done so far seems to just time between two array increments; however I want it to continue adding time:
Example
n time
500 0.0002
1000 0.0004
1500 0.0006
what i have is pretty much a same time interval:
n time
500 0.00017
1000 0.00015
1500 0.00018
my part of the coding is
if sortfunction==1:
array=x[increment-1:n:increment]
for my in array:
ff=sort_timehelp(x,quick_sort)
print "%d\t %f" %(my, ff)
i think there is something wrong with the for loop function. Any help? thanks
To accumulate the time, start the ff variable at zero and the add the new timings on iteration of the loop: