subject

The following routine removes the first half of the list passed as a parameter:

public static void removeFirstHalf(List<?> lst)
{
int theSize = lst. size() /2;
for( inti =0; i < theSize; i++ )
lst. remove(0);
}

(a) Why is theSize saved prior to entering the for loop?
(b) What is the running time of removeFirstHalf if lst is an ArrayList?
(c) What is the running time of removeFirstHalf if lst is a LinkedLIst?
(d) Does using an iterator make removeFirstHalf faster for either type of List?

ansver
Answers: 2

Another question on Computers and Technology

question
Computers and Technology, 22.06.2019 21:30
Write a function named printfloatrepresentation(float number) that will print the floating point representation of a number using the format given below. (sign bit) exponent in binary (assumed bit).significandfor example if the number passed an argument is 71 yourprogram should print (0) 10000101 (1).00011100000000000000000similarly if the number passed to the function as argument is -71 the program should print (1) 10000101 (1).00011100000000000000000
Answers: 3
question
Computers and Technology, 23.06.2019 01:30
How do you set up a slide show to play continuously, advancing through all the slides without requiring your interaction? a. click set up slide show, and then select the loop continuously until ‘esc' and show without narration options. b. click set up slide show, and then select the loop continuously until ‘esc' and use timings, if present options. c. click set up slide show, and then select the show presenter view and use timings, if present options. d. click set up slide show, and then select the show without animation and browsed at a kiosk (full screen) options.
Answers: 3
question
Computers and Technology, 23.06.2019 12:00
3. when you right-click a linked spreadsheet object, what commands do you choose to activate the excel features? a. linked worksheet object > edit b. edit data > edit data c. linked spreadsheet > edit d. object > edit data
Answers: 2
question
Computers and Technology, 23.06.2019 18:00
What can a word user do with the customize ribbon dialog box? check all that apply. minimize the ribbon add a new tab to the ribbon remove a group from a tab add a group to a tab choose which styles appear choose which fonts appear choose tools to appear in a group
Answers: 1
You know the right answer?
The following routine removes the first half of the list passed as a parameter:

public...
Questions
question
Computers and Technology, 23.08.2021 01:30
question
History, 23.08.2021 01:40
question
Mathematics, 23.08.2021 01:40
question
Health, 23.08.2021 01:40
question
Mathematics, 23.08.2021 01:40
question
Mathematics, 23.08.2021 01:40
Questions on the website: 13722363