Question: Use the Big O notation to analyze the time complexity of the following algorithms. Note: when answering each question below, your answer must include the

Use the Big O notation to analyze the time complexity of the following algorithms. Note: when answering each question below, your answer must include the whole process of your analysis plus the corresponding Big O notation. Only writing down the Big O notation is not acceptable.

(1). void mC(int m, int size) {

for (int i = 0; i < size; i++)

{

cout << m[i]; } for (int i = size - 1; i >= 0; )

{

cout << m[i]; i--; } }

2.

void mD(int m[], int size)

{

for (int i = 0; i < size; i++)

{

for (int j = 0; j < i; j++)

cout << m[i] * m[j];

}

}

(3).

for (int i = 0; i < SIZE; i++)

{

if (list[i] > list[i + 1])

{

swap list[i] with list[i + 1];

i = 0;

}

}

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!