-
Timming algorithm
I need help timing an Algorithm
I'm using unformated time not in seconds
using the function clock()
I need to run this program 10 times and get an average time for it I do this by having a big for loop that will run it 10 times
and the problem is that when i run it for sometimes it gives zero time
Ex:
0
0
0
0
0
10
0
0
0
0
Of course the average is 1
Is there any particular reason why it gives 0 time
Does the hardware affects the time(processor Memory etc,)
-
it may run so fast that it can't determine a time. You may want try a loop that does the calculation a few hundred or thousand times to find that out. If that doesn't work, you will probably want to look over the part that checks the time because that might be off. Hope that helps