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 01:40
Kali, a python programmer, is using the turtle module to write the word “hello.” which code should she use to indicate the location to begin writing the word? a # pick up the turtle and move it to its starting location. b penup(-100, 200) goto() pendown() c penup() goto(-100, 200) pendown() d # pick up the turtle and move it to (-100, 200)
Answers: 2
question
Computers and Technology, 22.06.2019 15:30
Which of the following examples has four beats in each measure?
Answers: 2
question
Computers and Technology, 22.06.2019 21:30
This graph compares the total cost of attending educational institutions in texas. the graph demonstrates that the cost at private and public technical schools greatly varies.
Answers: 2
question
Computers and Technology, 23.06.2019 08:30
All of these are true about using adhesive except: a. dissimilar materials can be joined. b. mixing tips are product and material specific. c. a specific application gun may be required. d. two-part adhesives are dispensed using two mixing tips
Answers: 3
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, 10.10.2019 22:30
question
Chemistry, 10.10.2019 22:30
Questions on the website: 13722360