You are given a Link List consisting of two pointers in each node, with one pointer of each node pointing to the next node just like in a single link list and the second pointer which is arbitary pointer can point to any node in the list and not just the previous node.
You have to complete the method which takes one argument: the head of the linked list. You should not read any input from stdin/console.
The struct Node has a data part which stores the data and a next pointer which points to the next element of the linked list and an arbitrary pointer (arb) which points to any arbitrary node .
There are multiple test cases. For each test case, this method will be called individually.
For each testcase, clone the given linked list.
The task is to complete the function copyList() which take one argument the head of the linked list to be copied and should return the head of the copied linked list.
1 <= T <= 100
1 <= N <= 100
1 <= Q <= 100
1 <= a, b <= 100
1 2 3 4
1 2 2 4
Testcase 1: In this test case, there are 4 nodes in linked list. Among these 4 nodes, 2 nodes have arbit pointer set, rest two nodes have arbit pointer as NULL. Third line tells us the value of four nodes. The fourth line gives the information about arbitrary pointers. The first node with set arbit pointer is 1, its arbit pointer is pointing to node 2. The second node with set arbit pointer is 2, its arbit pointer is pointing to node 4.