Computers and Technology

Determine how many times the output statement is displayed in each of the following fragments. indicate whether the algorithm is o(n) or o(n2).

a. for (int i = 0; i < n; i++) for (int j = 0; j < n; j++) system. out. println(i + " " + j);

b. for (int i = 0; i < n; i++) for (int j = 0; j < 2; j++) system. out. println(i + " " + j);

c. for (int i = 0; i < n; i++) for (int j = n - 1; j > = i; system. out. println(i + " " + j);

d. for (int i = 1; i < n; i++) for (int j = 0; j < i; j++) if (j % i == 0) system. out. println(i + " " + j);

answer
Answers: 1

Other questions on the subject: Computers and Technology

image
Computers and Technology, 21.06.2019 18:30, porkhappycom
Which number on the image above correctly indicates the name of a folder in this url? a.1b.2c.3d.4
Answers: 2
image
Computers and Technology, 23.06.2019 06:00, 573589
What machine listens for http requests to come in to a website’s domain? a. a router b. a browser c. a server d. a uniform resource locator
Answers: 1
image
Computers and Technology, 23.06.2019 09:30, GEEKLIFE6598
After you present a proposal, the committee starts asking you questions, some beyond the strict focus of your proposal. they ask questions about implications in other fields and knowledge about other fields. you are asked to redo your proposal. what is most likely missing? breadth of material depth of material clarity of material details of material
Answers: 1
image
Computers and Technology, 23.06.2019 09:30, shadowsnake
Write a function called checkfactor that takes two arrays of positive numbers, firstnumberrow and secondnumberrow. checkfactor checks if the first entry in firstnumberrow is divisible by the first entry in secondnumberrow, and performs the same operation on the next array elements until all entries have been checked. all the numbers are positive and the number of entries in the arrays are the same. the function should return the identified divisible numbers in two row arrays named firstdivisible and seconddivisible. restrictions: branches or loops should not be used. the code must use the internal mod and logical functions. hint: the mod function should be used to determine if two numbers are divisible. ex: for num1 and num2 if mod(num1,num2) is 0, then the two numbers are divisible. this is matlab
Answers: 2
Do you know the correct answer?
Determine how many times the output statement is displayed in each of the following fragments. indic...

Questions in other subjects: