Hey again I suffer with this task and could really need someone who knows more a
ID: 3633772 • Letter: H
Question
Hey again
I suffer with this task and could really need someone who knows more about this than me.
I got some help with examples and stuff recently and have tried on my own but it is just wrong no matter how much I try...
Create a method removeSubList in class LinkedList that takes two iterators as input, respectively, start and end of SubList to be removed.
These are classes:
class ListNode<AnyType>
{
// Constructors
public ListNode( AnyType theElement )
{
this( theElement, null );
}
public ListNode( AnyType theElement, ListNode<AnyType> n )
{
element = theElement;
next = n;
}
public AnyType element;
public ListNode<AnyType> next;
}
public class LinkedList<AnyType>
{
/**
* Return an iterator representing the header node.
*/
public LinkedListIterator <AnyType> last ()
{
list node; p = header;
while (p.next != null) {
p = p.next;
}
return new LinkedListIterator <AnyType> (p);
}
}
}
public class LinkedListIterator<AnyType>
{
public AnyType retrieve( )
{
return isValid( ) ? current.element : null;
}
ListNode<AnyType> current; // Current position
}