107,863 views
1 vote
1 vote
A. Line 1 for (i=1; i<=n; i++) { f(n) = O(_________)

Line 2 for (k= 0; k<=n/2; k++) { Critical Section is Line ___.
Line 3 System.out.println("Hello");
Line 4 }
Line 5 }

b. Line 1 for (int i=n-1; i<=n; i++) { f(n) = O(_________)
Line 2 for (int j=1; j<=n; j=j*2) { Critical Section is Line ___.
Line 3 System.out.println("Hello");
Line 4 }
Line 5 }

c. Line 1 for (int i=0; i < n; i++) { f(n) = O(_________)
Line 2 System.out.println(i); Critical Section is Line ___.
Line 3 if (i == 2) {
Line 4 break;
Line 5 }
Line 6 }

User Nonremovable
by
3.5k points

2 Answers

2 votes
2 votes

Answer:

answer is A

Step-by-step explanation:

hope this helps!

User Neurix
by
3.3k points
4 votes
4 votes

Answer:

a)

3

b)

log(n)

3

c)

1

2

Step-by-step explanation:

User Bahaa Hany
by
2.9k points