-->
当前位置:首页 > 题库

单选题:In the best case,which is the time complexity for the following

Luz5年前 (2021-06-19)题库608
In the best case,which is the time complexity for the following code?

       high=N-1;
       while(high>0){
               j=0;
               for(i=0;iA[i+1]){
                           swap(A[],i,i+1);     //swap the i and i+1 element of array A[]
                           j=i;
                     }
                     high=j;
               }
       }



A.O(1)
B.O($$logN$$)
C.O($$N$$)
D.Θ($$N^2$$)


答案:C