subject

Suppose list1 is an arraylist and list2 is a linkedlist. both contains 1 million double values. analyze the following code:
a: for (int i = 0; i < list1.size(); i++)
sum += list1.get(i);
b: for (int i = 0; i < list2.size(); i++)
sum += list2.get(i);
a. code fragment a runs faster than code fragment b.
b. code fragment b runs faster than code fragment a.
c. code fragment a runs as fast as code fragment b.

ansver
Answers: 2

Another question on Computers and Technology

question
Computers and Technology, 22.06.2019 20:00
What statement best describes operating systems? it’s possible for modern computers to function without operating systems. most operating systems are free or very inexpensive. operating systems are managed by the computer’s microprocessor (cpu). operating systems manage the computer’s random access memory (ram).
Answers: 1
question
Computers and Technology, 22.06.2019 21:00
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 starting from index 0. for each match, add one point to userscore. upon a mismatch, exit the loop using a break statement. assume simonpattern and userpattern are always the same length. ex: the following patterns yield a userscore of 4: simonpattern: rrgbryybgy userpattern: rrgbbrybgy
Answers: 2
question
Computers and Technology, 24.06.2019 02:00
What is a loop? a. a collection of function definitions at the top of a program b. a line of code that defines a variable and assigns it a value c. a program that opens the turtle graphics window d. a block of code that repeats a specific number of times
Answers: 1
question
Computers and Technology, 24.06.2019 17:40
The value of sin(x) (in radians) can be approximated by the alternating infinite series create a function (prob3_2) that takes inputs of a scalar angle measure (in radians) and the number of approximation terms, n, and estimates sin(x). do not use the sin function in your solution. you may use the factorial function. though this can be done without a loop (more efficiently), your program must use (at least) one. you may find the mod() function useful in solving the problem.
Answers: 1
You know the right answer?
Suppose list1 is an arraylist and list2 is a linkedlist. both contains 1 million double values. anal...
Questions
question
Mathematics, 02.08.2021 18:10
question
Mathematics, 02.08.2021 18:20
Questions on the website: 13722360