Ask Question
31 August, 02:43

Why is thesize saved prior to entering the for loop? 2. what is the running time of removefirsthalf if lst is an arraylist? 3. what is the running time of removefirsthalf if lst is a linkedlist?

+2
Answers (1)
  1. 31 August, 06:34
    0
    After entering the loop, it should use the correct list size and the loop will be affected if the remove call changes the size of the list. If lst is an Arraylist the running time of removefirsthalf is O (n^2). So when the beginning is removed the next element will move forward. If lst is a LinkedList which is a dynamic structure the running is O (n) for removefirsthalf
Know the Answer?
Not Sure About the Answer?
Get an answer to your question ✅ “Why is thesize saved prior to entering the for loop? 2. what is the running time of removefirsthalf if lst is an arraylist? 3. what is the ...” in 📙 Physics if there is no answer or all answers are wrong, use a search bar and try to find the answer among similar questions.
Search for Other Answers