Question: Determine the time complexity of the following function and find its big-O notation. int f1(int n) { int cnt = 0; for (int p1 =

  1. Determine the time complexity of the following function and find its big-O notation.

int f1(int n)

{

int cnt = 0;

for (int p1 = 0; p1 <= n; p1++)

for (int p2 = 0; p2 <= n - p1; p2++)

cnt++;

return cnt;

}

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!