Assummin that the size of input is n eg array of n items


What is the order of magnitude of the following code segment? Assummin that the size of input is n (e.g., array of n items) and that the statements inside the innermost loop are independent of n. 

for (int i=1; i<=n; i++)

{

        for (int j=1; j<=20; j++)

        {

                 for(int k=1; k<=5; k++)

                 {

                          //some statements independent of n

                 }

        }

}

a) O(n)

b) O(n^2)

c) O(n^3)

d) O(1)

Solution Preview :

Prepared by a verified Expert
Basic Computer Science: Assummin that the size of input is n eg array of n items
Reference No:- TGS02294569

Now Priced at $10 (50% Discount)

Recommended (97%)

Rated (4.9/5)