subject

1. What is the big O value for the following code in terms of n? …
for(int j = 2; j < n + 5; j++)
{
for(int k = 0; k < (n*n* n); k++)
{
…some code…
}
}
3. What is the average big O value for the following code in terms of n?

for(int j = 13; j < n; j+=20)
{
…some code…
}
1. What is the big O value for the following code in terms of n?

int j = 0, k =1;
do
{
p[j++] = I * Math. pow(k,2);
k++;
}while(k < n - 2);
5. What is the big O value for the following code in terms of n?

int p = 5;
while(p < n)
{
…some code…
p = p * 4;
}
6. What is the big O value for the following code?
p = n*n + 2;
m = Math. pow(p, .008);
9. If an algorithm having a big O value of O(n3) takes 2 sec to process a section of code 2000 times, how many times could we process the code in 16 sec?
11. Write a static recursive method that will receive an integer n as a parameter and return an integer that is n! (n factorial)?
12. What is printed by the following?
System. out. println(doStuff(7));
public static int doStuff(int n)
{
if (n<=0)
return 20;
else
return n + doStuff(n-2);
}
13. What is displayed by printStuff(9)?
public static void printStuff(int n)
{
if (n <= 1)
System. out. print(n);
else
{
printStuff(n / 2);
System. out. print(“,” + n);
}
}
14. How is the Fibonacci sequence defined?
16. What is returned by seq(3)?
public static int seq(int n)
{
if (n = = 0)
{
return 5;
}
else if (n = = 1)
{
return 11;
}
else
{
return seq(n - 1) + 3 * seq(n - 2);
}
}

ansver
Answers: 3

Another question on Computers and Technology

question
Computers and Technology, 23.06.2019 01:30
For a typical middle-income family, what is the estimated cost of raising a child to the age of 18? $145,500 $245,340 $304,340 $455,500
Answers: 2
question
Computers and Technology, 23.06.2019 07:00
You need a quick answer from a coworker. the most effective way to reach your coworker is through a. cloud server b. instant message c. teleconference d. telepresence
Answers: 1
question
Computers and Technology, 24.06.2019 10:50
In 2009 to 2010, how many social network users were reported as being victims of online abuse? a. 1 in 10 b. 100% c.1 in 100 d. 50%
Answers: 2
question
Computers and Technology, 24.06.2019 21:30
How is a wan different than a lan? both connect computers, but only wan users don’t need the same operating system. both are peer-to-peer networks, but only a wan requires networking hardware. both network computers, but only a wan can cover larger geographical ranges. both connect computers to the internet, but only wan connects to the cloud.
Answers: 1
You know the right answer?
1. What is the big O value for the following code in terms of n? …
for(int j = 2; j < n +...
Questions
question
Mathematics, 19.02.2021 08:50
question
Mathematics, 19.02.2021 08:50
Questions on the website: 13722363