Question: I need help for this questions Write the method removeBetween, member of the class LinkedList. The method takes two elements e_1 and e_1, and removes
Write the method removeBetween, member of the class LinkedList. The method takes two elements e_1 and e_1, and removes all the elements between the two elements (e_1 and e_2 not included). If e_1 or e_2 or both do not exist, no element will be removed. You can assume the elements of the list to be unique, and that e_1 notequalto e_2. Do not call any methods and do not use any auxiliary data structures. The method signature is: public void removeBetween(T e_1, T e_2). If the list: a rightarrow c rightarrow d rightarrow b rightarrow r rightarrow x, then after calling removeBetween("c", "r"), the list becomes: a rightarrow c rightarrow r rightarrow x. Write the method removeFirst, member of class LinkedList, that removes the first occurrence of every element that appears more than once in the list. Do not use any auxiliary data structures and do not call any methods. The method signature is public void removeFirst(). What is the running time of this method? If the list contains: B rightarrow A rightarrow A rightarrow R rightarrow C rightarrow A rightarrow C rightarrow R, then after calling removeFirst, its content becomes B rightarrow A rightarrow A rightarrow C rightarrow R. Write the method removeEvenElems, member of the class ArrayList, that removes all the elements having an even position (the position of the first element is 0). The method must run in O(n). The method signature is: public void removeEvenElems (). Do not call any method
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
