DSA

Data structure & algorithm using swift language.

How to create deep copy of linked list who has random pointer

[Question]: Create a deep copy of the linked list. which consist of exactly n fresh new nodes, where each new node has its value set to the value of its corresponding original node. Both the next and random pointer of the new nodes should point to new nodes in the copied list such that the pointers in the original list and copied list represent

How to create deep copy of linked list who has random pointer Read More »