1018,6,2

为什么循环中例如:

1. for (int i = 0; i < length;i++){

    for (int j =0; j< length;j++){

      ....;

    }

  }

2. for (int i = 0; i < length;i++){

    for (int j =i+1; j< length;j++){

      ....;

    }

  }

1运行时间远小于2?

猜测:

  可能是编译器,在编译第一条和编译第二条存在差异,一个是直接编译,一个需要运行时编译???

猜你喜欢

转载自www.cnblogs.com/vizdl/p/9125950.html