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, 22.06.2019 15:00
Who is the first president to use social media as part of his campaign strategy
Answers: 1
question
Computers and Technology, 23.06.2019 14:30
The option enables you to modify a slide element in most presentation applications.
Answers: 2
question
Computers and Technology, 23.06.2019 21:40
Simon says is a memory game where "simon" outputs a sequence of 10 characters (r, g, b, y) and the user must repeat the sequence. create a for loop that compares the two strings. for each match, add one point to user_score. upon a mismatch, end the game. sample output with inputs: 'rrgbryybgy' 'rrgbbrybgy'
Answers: 3
question
Computers and Technology, 23.06.2019 23:00
How do you know if the website is secure if you make a purchase
Answers: 2
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
Arts, 11.11.2020 01:50
question
History, 11.11.2020 01:50
question
Mathematics, 11.11.2020 01:50
question
Mathematics, 11.11.2020 01:50
question
Mathematics, 11.11.2020 01:50
question
Mathematics, 11.11.2020 01:50
question
Mathematics, 11.11.2020 01:50
Questions on the website: 13722362