Write an easier version of a linked list with only a couple of the normal linked list functions and the ability to generate and utilize a list of ints.  The data type of the connection to the following node can be just Node, and the data element can be just an int. You will need a reference (Java) or either a reference or a pointer (C++) to the first node, as well as one to the last node. * Create a method or function that accepts an integer, constructs a node with that integer as its data value, and then includes the node to the end of the list.  If the new node is the first one, this function will also need to update the reference to the first node. This function will need to update the reference to the final node.  Consider how to insert the new node following the previous last node, and keep in mind that the next reference for the list's last node should be null. * Create a different method or function that iteratively explores the list, printing the int data values as it goes. It should start at the first node, follow the links to the final node, and so forth. * Write another function/method that takes an int parameter and determines whether that int is contained in the list. **Fianlly, to show that your list code is functional, create a main() method or JUnit tests.  A list should be created, some nodes added, and then the list should be searched for a value that is *not* in the list and then for a value that *is* in the list.  Additionally, make a list without any nodes and do a value search on it.**

C++ Programming: From Problem Analysis to Program Design
8th Edition
ISBN:9781337102087
Author:D. S. Malik
Publisher:D. S. Malik
Chapter18: Stacks And Queues
Section: Chapter Questions
Problem 22SA
icon
Related questions
Question

(IntelliJ)

Write an easier version of a linked list with only a couple of the normal linked list functions and the ability to generate and utilize a list of ints.  The data type of the connection to the following node can be just Node, and the data element can be just an int. You will need a reference (Java) or either a reference or a pointer (C++) to the first node, as well as one to the last node.

* Create a method or function that accepts an integer, constructs a node with that integer as its data value, and then includes the node to the end of the list.  If the new node is the first one, this function will also need to update the reference to the first node. This function will need to update the reference to the final node.  Consider how to insert the new node following the previous last node, and keep in mind that the next reference for the list's last node should be null.

* Create a different method or function that iteratively explores the list, printing the int data values as it goes. It should start at the first node, follow the links to the final node, and so forth.

* Write another function/method that takes an int parameter and determines whether that int is contained in the list.

**Fianlly, to show that your list code is functional, create a main() method or JUnit tests.  A list should be created, some nodes added, and then the list should be searched for a value that is *not* in the list and then for a value that *is* in the list.  Additionally, make a list without any nodes and do a value search on it.**

Expert Solution
steps

Step by step

Solved in 3 steps with 1 images

Blurred answer
Knowledge Booster
Structure
Learn more about
Need a deep-dive on the concept behind this application? Look no further. Learn more about this topic, computer-science and related others by exploring similar questions and additional content below.
Similar questions
  • SEE MORE QUESTIONS
Recommended textbooks for you
C++ Programming: From Problem Analysis to Program…
C++ Programming: From Problem Analysis to Program…
Computer Science
ISBN:
9781337102087
Author:
D. S. Malik
Publisher:
Cengage Learning