Name: Anonymous 2012-01-16 8:59
for (I = 0; I < N; I++)
for (J = 0; J < M; J++)
update(Xs[I][J]);or
for (I = 0; I < N; I++)
for (J = 0; J < M; J++)
update(Xs[J][I]);???
for (I = 0; I < N; I++)
for (J = 0; J < M; J++)
update(Xs[I][J]);
for (I = 0; I < N; I++)
for (J = 0; J < M; J++)
update(Xs[J][I]);int var = ++i; is fewer instructions than int var = i++;i++ and ++i are different things, but OP is using it as they are equal even though they result in the same thing.
'
>inb4 they evaluate to the exact same thing on my computer++i methinks, but rather that some compilers *cough*micro$hit*cough* requires variables do be declared first in functions.
for (int i = 0; i < height; i++}
for (int j = 0; j < width; j++)
array[i][j] = value;
for (int i = 0; i < size; i++}
array[size / i][size % i] = value;
int var = ++i; results in var == 11, while int var = i++; results in var == 10. These two do not result in the same thing.for (i = 0; i < X; ++i) and for (i = 0; i < X; i++) result in the same thing, I used the example with int var = ++i and int var = i++ to prove the point that i++ and ++i are two very different things and one of them (depending on the compiler/interpreter/whatever) may yield better performance than the other, unless the compiler figures it out.
for (int i = 0; i < size; i++}
array[size / i][size % i] = value;size / 0 and size % 0size = height * width.
size / 0 when that snippet of code isn't even going to cover half of the elements in that array.
% is modulo, even in JSP. <% however is not, but then again, that's not valid syntax in any C-like language.
class test {
public static void main(String[] args) {
int herp = 3, derp = 0;
System.out.println(herp % derp);
}
}'
>hurr durr