Return Styles: Pseud0ch, Terminal, Valhalla, NES, Geocities, Blue Moon. Entire thread

Which loop is faster?

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]);

???

Name: kodak_gallery_programmer !!kCq+A64Losi56ze 2012-01-16 13:05

>>50
Again, I think you need to write some code instead of just googling shit. Oh wait, you don't have the mental capacity to code! Anyways, here is what I get when I run the loop in Java...

public class Main {

    public static void main(String[] args) {
        int value = 0;
        int size = 5;

        int[][] array = new int[10][10];
        for (int i = 0; i < size; i++)
            array[size / i][size % i] = value;
       
    }
}

run:
Exception in thread "main" java.lang.ArithmeticException: / by zero
        at Main.main(Main.java:10)
Java Result: 1
BUILD SUCCESSFUL (total time: 0 seconds)

Newer Posts
Don't change these.
Name: Email:
Entire Thread Thread List