Question: java language Write the following classes that implement a single Linked List of integers: Class Node It includes two instance variables: Int number and Node

java language  java language Write the following classes that implement a single Linked

Write the following classes that implement a single Linked List of integers: Class Node It includes two instance variables: Int number and Node next. It contains the following methods: A constructor that Initializes the instance variable number Set and get method for each instance variable. Class Single Linked List: It includes two instance variables: Node head and Node tail. It contains the following methods: public void Insert (int n) that creates and adds a Node at the end of the linked List. public void print () that prints the values of all nodes in the finked list, separated by an arrow (rightarrow). as shown in the sample output public Boolean one Digit () that returns true if all nodes in the linked List have a one-digit value and false otherwise public void iterative Reverse () that reverses the original linked list iteratively. public void recursive Reverse () that calls the private method void recursive Reverse (Node head) private void recursive Reverse (Node current) that reverses the original linked list recursively. Class Test Single Linked List in the main method, do the following: Create an object of class Single Unwed List Read integer values from the user. the user must enter -1 to stop. Call method print () Call method one Digit () and print a proper message based on the returning value. Call method recursive Reverse () and then call method print() Call method iterative Reverse () and then call method print() Enter integer values or -1 to stop: 5 2 4 6 7-1 5 rightarrow 2 rightarrow 4 rightarrow 6 rightarrow 7 All values in Linked List are one-digit integers Reversing the Linked List using recursive method

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!