subject

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

ansver
Answers: 1

Other questions on the subject: Computers and Technology

image
Computers and Technology, 22.06.2019 15:30, gudon986732
When creating a budget, log fixed expenses before income. after income. after savings. at the top.
Answers: 1
image
Computers and Technology, 22.06.2019 18:00, ladyree8721
Which of the following physical laws can make the flow of water seem more realistic? a. motion b. gravity c. fluid dynamics d. thermodynamics
Answers: 2
image
Computers and Technology, 23.06.2019 22:30, kayelynn003
How many points do i need before i can send a chat
Answers: 1
image
Computers and Technology, 24.06.2019 02:20, isabelsmhl
Peter is thinking of a number which isless than 50. the number has 9 factors. when he adds 4 to the number, itbecomes a multiple of 5. what is thenumber he is thinking of ?
Answers: 1
You know the right answer?
Determine how many times the output statement is displayed in each of the following fragments. indic...

Questions in other subjects:

Konu
Mathematics, 11.03.2021 20:20