Hi everyone, I'm working on a program here and came across this discovery
ANDCode:for(i=0;i<Nli++){ while(arr[i] * h[index[i]] <= h[num-1]) index[i]+=1; }
When i run both in my program, the compile time for the first code is 0 seconds however for the second code it takes 5 second.Code:for(i=0;i<Nli++){ index=0; while(arr[i] * h[index] <= h[num-1]) index++; }
Can someone explain to me why is it that using index as an array is faster?
Thanks