Computers and Technology

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);
}
}

answer
Answers: 3

Other questions on the subject: Computers and Technology

image
Computers and Technology, 22.06.2019 11:00, simbupls
Technician a says that the radiator usually cools better if the front air dam is removed. technician b says that when a condenser has a leak it can be repaired easily with epoxy. who is correct?
Answers: 1
image
Computers and Technology, 22.06.2019 16:30, aryal191
Primary tech skills are skills that are necessary for success in online education
Answers: 3
image
Computers and Technology, 23.06.2019 22:20, Izzyfizzy
Read “suburban homes construction project” at the end of chapters 8 and 9 (in the textbook) and then develop a wbs (work breakdown structure) in microsoft excel or in microsoft word (using tables)
Answers: 1
image
Computers and Technology, 24.06.2019 02:30, sha273
Which option completes the explanation for conflict of interest in an organization
Answers: 1
Do you know the correct answer?
1. What is the big O value for the following code in terms of n? …
for(int j = 2; j < n +...

Questions in other subjects: