Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Write (he following dashes that implement a single Linked List of integers Class Node it includes two instance variables: int number and Node next. -

image text in transcribed
Write (he following dashes 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: o A constructor that initializes the instance variable number o Set and get method for each instance variable. Class Single Linked List - It induces two instance variables: Node head and Node Ilia. - It contains the following methods: o public void Insert (Int n) that creates and adds a Node at the end of the Unlit List. o public void print 0 that prints the values of all nodes in the linked list separate by an arrow ( rightarrow ), as shown in the sample output. o public Boolean one Diglot () that returns true if all nodes in the linked List have one-digit value and false otherwise. o public void Iterative Reverse () that reverses the original linked list iteratively. o public void recursive Reverse 0 that cafe the private method i recursive Reverse (Node head) o private void recursive Reverse (Node current) that reverses the original Un list recursively. Class Tots Single Linked List. in the main method, do the following. - Create an object of dads Single Linked List. - Read integer values from the user. the user must enter -1 to stop. - Call method print () - Call method one Diglot () 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 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: Write (he following dashes 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: o A constructor that initializes the instance variable number o Set and get method for each instance variable. Class Single Linked List - It induces two instance variables: Node head and Node Ilia. - It contains the following methods: o public void Insert (Int n) that creates and adds a Node at the end of the Unlit List. o public void print 0 that prints the values of all nodes in the linked list separate by an arrow ( rightarrow ), as shown in the sample output. o public Boolean one Diglot () that returns true if all nodes in the linked List have one-digit value and false otherwise. o public void Iterative Reverse () that reverses the original linked list iteratively. o public void recursive Reverse 0 that cafe the private method i recursive Reverse (Node head) o private void recursive Reverse (Node current) that reverses the original Un list recursively. Class Tots Single Linked List. in the main method, do the following. - Create an object of dads Single Linked List. - Read integer values from the user. the user must enter -1 to stop. - Call method print () - Call method one Diglot () 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 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

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

Data Management Databases And Organizations

Authors: Watson Watson

5th Edition

0471715360, 978-0471715368

More Books

Students also viewed these Databases questions

Question

=+3 In what ways can an MNE improve or change its approach to IHRM?

Answered: 1 week ago