Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

1 . Analyze the big - oh run time of each method in terms of the variable n: void A ( int n ) {

1. Analyze the big-oh run time of each method in terms of the variable n:
void A(int n)
{
if (n <10)
time++;
else
{
for (int i =0; i < n; i++)
time++;
A(n -2);
}
}
void B(int n)
{
if (n <10)
time++;
else
{
for (int i =0; i <8; i++)
B(n /2);
for (int i =0; i < n*n; i++)
time++;
}
}
void C(int n)
{
if (n <10)
time++;
else
{
C(n /2);
C(n /5);
C(n /10);
for (int i =0; i < n; i++)
time++;
}
}
void D(int n)
{
time =0;
for (i =0; i < n; i++)
for (j =0; j < i * i; j++)
for (k =0; k < j*j; k++)
time++;
}
void E(int n)
{
if (n <15)
time++;
else
{
E(n /3);
for (i =0; i < n; i++)
time++:
E(2* n /3);
}
}
void D(int n)
{
if (n <20)
time++;
else
{
for (i =10; i <100*n; i++)
time++;
D(n /5);
D(7* n /10);
for (i =1; i <12* n; i++)
time++;
}
}

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

Database Internals A Deep Dive Into How Distributed Data Systems Work

Authors: Alex Petrov

1st Edition

1492040347, 978-1492040347

Students also viewed these Databases questions

Question

What is the purpose of the Salary Structure Table?

Answered: 1 week ago

Question

What is the scope and use of a Job Family Table?

Answered: 1 week ago