Question: Output a linked list Write a recursive method called printLinkedList ( ) that outputs the integer value of each node in a linked list. Method

Output a linked list
Write a recursive method called printLinkedList() that outputs the integer value of each node in a linked list. Method printLinkedList() has one parameter, the head node of a list. The main program reads the size of the linked list, followed by the values in the list. Assume the linked list has at least 1 node.
Ex: If the input of the program is:
512345
the output of the printLinkedList() method is:
1,2,3,4,5,
Hint: Output the value of the current node, then call the printLinkedList() method repeatedly until the end of the list is reached. Refer to the IntNode class to explore any available member methods that can be used for implementing the printLinkedList() 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!