8.12 LAB: Output a linked list
Write a recursive function called print_list() that outputs theinteger value of each node in a linked list. Function print_list()has one parameter, the head node of a list. The main program readsthe 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:
the output of the print_list() function is:
Hint: Output the value of the current node, then call theprint_list() function repeatedly until the end of the list isreached. Refer to the Node class to explore any available instancemethods that can be used for implementing the print_list()function.
8.12 LAB: Output a linked list Write a recursive function called print_list() that outputs the integer value of each nod
-
- Site Admin
- Posts: 899603
- Joined: Mon Aug 02, 2021 8:13 am