In lecture we illustrated and explained the LinkedList ADT and some of the typical operations it would have defined in it. You must fill in the incomplete methods in the LinkedList class such that it executes correctly with the Tester. As usual your output must match the expected output indicated by the screen shots
Implement the following methods in your LinkedList.java fileWrite them as conscisely and simply as you can
- public int size() Write simplest loop you can to count the Nodes
- public boolean empty() Must call size() NOT examine head and be written as 1 line return statement
- public boolean contains( T key ) Must call search and be written as 1 line return statement
- public Node<T> search( T key ) 1 simple loop return ref to 1st Node that contains key value
- public void insertAtTail(T data) Walk list to caboose (last Node). new Node become the new caboose
- public void insertInOrder(T data) Insert Node into proper alphabetic/lexical position in list
*** insertInOrder DO NOT cast to Comparable becuase we do .
- public boolean remove(T key) Walk list until you find 1st Node with this key. Remove Node w/out breaking list
- public boolean removeAtTail() Remove the caboose Node
- public boolean removeAtFront() Remove the first Node of list w/out breaking list
# THESE NEXT 4 METHODS PRODUCE THE SAME RESULT AS ARRBAG. NO DUPES ALLOWED. MUST TEST BEFORE ADDING TO RESULT
- public LinkedList<T> union( LinkedList<T> other )
- public LinkedList<T> inter( LinkedList<T> other )
- public LinkedList<T> diff( LinkedList<T> other )
- public LinkedList<T> xor( LinkedList<T> other )