Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Please, I want to solve all the paragraphs with a correct and clear solution. The solution must be in text format. Handwriting is completely rejected.

Please, I want to solve all the paragraphs with a correct and clear solution. The solution must be in text format. Handwriting is completely rejected. I want answers, I do not want explanation.

Question 1: [ 2 Marks]

What is running time analysis
What is asymptotic analysis of algorithms?

Question 2: What is the time complexity of following code: [2 Marks]

static int rec(int n)

{

int g[] = new int[n+2];

int i;

g[0] = 0;

g[1] = 1;

for (i = 2; i <= n; i++)

{

g[i] = g[i-1] + g[i-2];

g[i] = g[i-1] - g[i-2];

}

return g[n];

}

Question 3: Find the complexity of the below program: [2Marks]

int a = 0, b = 0;

for (i = 0; i < N; i++) {

a = a + r();

a = a - r();

}

for (j = 0; j < M; j++) {

b = b + r();

}

Question 4: What is the time complexity of following code: [2Marks]

int a = 0;

for (j = N; j > i; j--) {

a = a + i + j;

}

Question : 5 Find the complexity of the below program [ 2 Marks]

public static int example5(int[ ] first, int[ ] second) { // assume equal-length arrays

int n = first.length, count = 0;

for (int i=0; i < n; i++) { // loop from 0 to n-1

int total = 0;

for (int j=0; j < n; j++) // loop from 0 to n-1

total += first[k];

if (second[i] == total) count++;

} return count;

}

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Oracle Database Foundations Technology Fundamentals For IT Success

Authors: Bob Bryla

1st Edition

0782143725, 9780782143720

More Books

Students also viewed these Databases questions

Question

1 . Television News channels importantance of our Life pattern ?

Answered: 1 week ago

Question

1. How is the newspaper help to our daily life?

Answered: 1 week ago

Question

1. Prepare a short profile of Mikhail Zoshchenko ?

Answered: 1 week ago

Question

What is psychology disorder?

Answered: 1 week ago

Question

=+j Explain the relationship between unions and MNEs.

Answered: 1 week ago