Question: 1. Create a class MLL, a singly linked, non-circular list where each node only has one link next and the list has a head and
1. Create a class MLL, a singly linked, non-circular list where each node only has one link next and the list has a head and a tail link (think about implementation of node). The MLL class also implements the Iterable interface. The following should be implemented as well:
2. Add the methods to the MLL class:
a. iterator() to implement the Iterable interface. This method returns an instance of MLLI initialized appropriately.
b. addFirst( value) that adds a value to the front of the list
c. addEnd( value) that adds a value to the end of the list - don't forget the boundary cases
d. A get method which given an index returns the element.
3. Create a class MLLI that implements the Iterator interface.
4. Create a class called MLIC which uses your new data structure. It only needs to implement the following methods:
a. addToBack
b. addToFront
c. Search for a value (this should search for an Integer in the list and return the first index of the value if it is present, if not return -1. The array is not sorted). Two versions of this method are needed. One which uses an iterator and one which does not.
The programming language is java.
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
