We use cookies to ensure you have the best browsing experience on our website. Please read our cookie policy for more information about how we use cookies.
Can any one please tell me why the below code is timing out for large data set:
for(intj=0;j<k;j++){for(intcurrent=n-1;current>=0;current--){if(current!=0){if(temp!=0){a[current-1]=a[current-1]+temp;temp=a[current-1]-temp;a[current-1]=a[current-1]-temp;}else{temp=a[current-1];a[current-1]=a[current];//for the first time}}else//when current reaches the first element{a[n-1]=temp;}}}Console.WriteLine(string.Join(" ",a));
Arrays: Left Rotation
You are viewing a single comment's thread. Return to all comments →
Can any one please tell me why the below code is timing out for large data set: