Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

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.
image text in transcribed

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Oracle 10g Database Administrator Implementation And Administration

Authors: Gavin Powell, Carol McCullough Dieter

2nd Edition

1418836656, 9781418836658

More Books

Students also viewed these Databases questions

Question

3. About the long-term trend of U.S. economic growth.

Answered: 1 week ago

Question

1. How gross domestic product (GDP) is defined and measured.

Answered: 1 week ago