Question: This is a circular doubly linked list. It starts at the head pointer (Head). Write a function that adds a node (P) at the

This is a circular doubly linked list. It starts at the head pointer (Head). Write a function that adds a node (P) at the nth location away from the Head keeping the circle connected. For example, based on the image, the list is: C, D, B, A After calling addNthNode(Head, P, 2), the list becomes C, F, D, B, A Note that if the position is 1 then the Head should be updated. Your code should validate parameters, and handle edge cases. void addNthNode (Node Head, Node P, int position) { // your code goes here } A Head B D FL P
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
