Ask Question
11 November, 23:26

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?

+4
Answers (1)
  1. 12 November, 00:51
    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?
Find 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 you're in doubt about the correctness of the answers or there's no answer, then try to use the smart search and find answers to the similar questions.
Search for Other Answers