Question: Use the provided template below to create the function: Node* add(Node* head, int index, int valueInput) { //your code here } Add Node to a

Use the provided template below to create the function:
Node* add(Node* head, int index, int valueInput) {
//your code here }
Add Node to a List Problem Statement Write a function add(Node* head, int index, int value) to add a node to a linked list. The head of the linked list is input, as well as the index where the node should be added and the value associated with the node. The program returns the head of the updated list. If the index of insertion is greater than the size of the list, the program should return NULL. We have defined the following node C++ class for you: class Node { public: int value; Node* next = NULL; }; The program input is a value, an index, and a list
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
