Which loop configuration will take more time to run?

Posted by eSKay on Stack Overflow See other posts from Stack Overflow or by eSKay
Published on 2010-03-23T12:40:52Z Indexed on 2010/03/23 12:43 UTC
Read the original article Hit count: 172

Filed under:
|

Code I:

for(i=0; i<100; i++){
  for(j=0; j<1000; j++){
    x = y;
  }
}

Code II:

for(i=0; i<1000; i++){
  for(j=0; j<100; j++){
    x = y;
  }
}

Which of these loop configurations will take more time to run and why?

© Stack Overflow or respective owner

Related posts about c

    Related posts about interview-questions