Big o of For int I 1I
Big o of
For( int I = 1;I<N; i*=2)
For ( int j= 0;j<I; j++)
B)
For(int I =1; i<=N; I++)
For( int k =I ; k <=N; k++)
C)
Big o of
For( int I = 1;I<N; i*=2)
For ( int j= 0;j<I; j++)
B)
For(int I =1; i<=N; I++)
For( int k =I ; k <=N; k++)
C)
For( int I = 1;I<N; i*=2)
For ( int j= 0;j<I; j++)
B)
For(int I =1; i<=N; I++)
For( int k =I ; k <=N; k++)
C)
Solution
a) in this program Big O of the progran is O(N). because the outer loop runs exponentially in logarithmatic time which is log(N). the inner loop runs from 0 to i, which means j runs exponentially in log (N) time. therefore both of the loop runs in the time of o(N).
*************END**********PLS GIVE ME GOOD RATING**********************************************
