Question: Part I: Implement a Single linked list to store a set of Integer numbers ( no duplicate ) ( 1 0 0 points ) Instance

Part I: Implement a Single linked list to store a set of Integer numbers (no duplicate)(100 points)
Instance variable
Constructor
Accessor and Update methods
Define a Node Class.
a. Instance Variables
E element-(generics framework)
Node Next (pointer)- refer to the next node (Self-referential)
b. Constructor
c. Methods
E getElement()//Return the value of this node.
setElement(E e)// Set value to this node.
Node getNext()//Return the pointer of this node.
setNextNoden??Setpoertothisnode.
displayNode()//Display information of this node.
Define SLinkedList Class
a. Instance Variables:
Node head
Node tail
int size
b. Constructor
c. Methods
int getSize()//Return the number of nodes of the list.
boolean isEmpty()//Return true if the list is empty, and false otherwise.
int getFirst()//Return the value of first node of the list.
int getLast()//Return the value of Last node of the list.
Node getHead()//Return the head
setHead(Node h)//Set the head
Node getTail()//Return the tail
setTail(Node t)//Set the tail
addFirstEe??addnewelementtothefrontofthelist
e)// add new element to the end of the list
E removeFirst )//Return the value of the first node of list
display()//print out values of all the nodes of the list
Node search(E key)//check if a given k is in the list, return found nodes or null
Node update(E key, E e)//update the value of a given k to new value, return updated node
Define TestSLinkedList Class
a. Declare an instance of Single List class.
b. Test all the methods of Single List class.
 Part I: Implement a Single linked list to store a set

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!