Half of the integers stored in the array data are positive, and half are negative. Determine the
Fantastic news! We've Found the answer you've been seeking!
Question:
Half of the integers stored in the array data are positive, and half are negative. Determine the absolute speed of the following algorithm, assuming: the time to execute a memory access is 100 nanoseconds and that all other operations (arithmetic, register accesses, etc.) take 10 nanoseconds.
for(int i = 0; i<1000000; i++)
{ if(data[i] < 0 )
data[i] = data[i] * 2;
}
Related Book For
Practicing Statistics Guided Investigations for the Second Course
ISBN: 978-0321586018
1st edition
Authors: Shonda Kuiper, Jeff Sklar
Posted Date: