Question: Linked List : Write a function find(Node* node, int valueInput) that starts at the given node and returns the index of the node with the
Linked List :
Write a function find(Node* node, int valueInput) that starts at the given node and returns the index of the node with the value valueInput. Indices start at 0. Return -1 if valueInput does not exist.
We have defined the following ?node C++ class for you:
class Node { public: int value; Node* next = NULL; }; Sample Input 1:
5 1->2->5
Sample Output 1:
2
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
