Interesting interview question…

Today I was asked this question. We have 2 cases with code blocks A, B and C. These code block don't share any resources except an iterator (int i).

Please give 3 possible reasons why case 1 could be faster than case 2, and 3 possible reasons why case 2 could be faster than case 1:

case 1

for (i=0; i

case 2

for (i=0; i

Link:http://programmers.stackexchange.com/questions/64132/interesting-interview-question

 

你可能感兴趣的:(Java)