+ 1

Cpp code to python help!! (Difficulties in understanding for loop in python)

for (k = size / 2;k > 0;k /= 2) { for (j = k;j < size;j++) { for (i = j - k;i >= 0;i -= k) { if (array[i + k] >= array[i]) { break; } else { mid = array[i]; array[i] = array[i + k]; array[i + k] = mid; } } } } return 0; }

8th Jun 2017, 11:48 PM
thomo
thomo - avatar
1 Answer