Clear Explination


#1

suppose the input linked list is 1[102] -> 2[154] -> 3[213] -> 4[145] , the numbers in brackets are the addresses of the nodes .
that is : (1,102,154,145) , (2,154,213,145) , ( 3,213,145,102) , ( 4,145,NULL,154)

where the first field is the val ( or label in this case), the second field is the address of the node,
the third field is the address of the next node, and the fourth field is the address of random node.

all we have to do is get 4 new nodes using the new keyword in C++ and have similar Linked list, i.e 1 possible solution could be
(1,112,164,155) , (2,164,223,155) , ( 3,223,155,112) , ( 4,155,NULL,164)

notice that the Linked list is almost same, just the addresses are new, otherwise even the order of the linked list is same.


#2

thank you very much…great help


#3

thanks for clear explanation