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
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;
}
Step by Step Solution
3.48 Rating (151 Votes )
There are 3 Steps involved in it
The question is complete so lets proceed with the solution We need to determine the absolute speed of the given algorithm specifically looking at the ... View full answer
Get step-by-step solutions from verified subject matter experts
