Question: Write a function to return the value at nth position in a linked list. Start indexing at zero. The function takes two arguments: the linked

Write a function to return the value at nth position in a linked list. Start indexing at zero. The function takes two arguments: the linked list head and the position to search for. Return the value at that position. Return-1 if the position is not found. int LinkedListNthNode(node head, int position) The linked list structure: struct node int value node *next; f; The following code will run to test your function: int output LinkedListNthNode (head, position); cout 3-4 -5 2 //position 1
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
