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 06:00
Pthe price of tickets in a group when a purchased in bulk can be found with the equation c=px+24 were c is the cost, p is the number of people,and x is the price per ticket. what is price of of each ticket if it costs $189 to buy tickets for 15 people ? a $8 b $24c $9d $11 show work
Answers: 1
question
Computers and Technology, 23.06.2019 02:30
Research data that is presented using descriptive language is said to be
Answers: 2
question
Computers and Technology, 23.06.2019 22:00
Take a critical look at three gui applications you have used—for example, a spreadsheet, a word-processing program, and a game. describe how well each conforms to the gui design guidelines listed in this chapter.
Answers: 3
question
Computers and Technology, 24.06.2019 17:50
You work in the accounting department and have been using a network drive to post excel workbook files to your file server as you complete them. when you attempt to save a workbook file to the drive, you see the error message: “you do not have access to the folder ‘j: \’. see your administrator for access to this folder.” what should you do first
Answers: 2
You know the right answer?
The following routine removes the first half of the list passed as a parameter:

public...
Questions
question
Chemistry, 12.10.2019 23:30
question
English, 12.10.2019 23:30
question
Mathematics, 12.10.2019 23:30
question
Mathematics, 12.10.2019 23:30
question
Biology, 12.10.2019 23:30
Questions on the website: 13722361