Question: 1) What is the number of basic steps executed by the following method (as a function of n)? 2) What is the big-O of the

1) What is the number of basic steps executed by the following method (as a function of n)?

2) What is the big-O of the method?

Public int howLongA(int n) {

int k = 0, kk = 0;

for(int i = 0; i < n/2 ; i++) {

k++;

for(int j = 0; j < n/2; j++)

kk++;

}

return k*kk;

}

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!