Home /
Expert Answers /
Computer Science /
in-java-dividing-a-linked-list-into-two-sublists-of-almost-equal-sizes-add-the-operation-method-div-pa976
(Solved): in java Dividing a linked list into two sublists of almost equal sizes. Add the operation/method div ...
in java
Dividing a linked list into two sublists of almost equal sizes. Add the operation/method divideMid to the class LinkedListType as follows: public class LinkedList\{ Node head; //This operation divides the given list into two sublists of (almost) equal sizes. public LinkedList divideMid() Consider the following statements: LinkedList myList=new LinkedList(); / / creates an empty list / /statememts that inserts elements into myList LinkedList sublist; //The statement: sublist=myList. divideMid (); divides myList into two sublists: myList points to the first half of the list, and subList points to the second half of the list.