You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
When a root node of Linked List is given, each node has next, random pointer,
deep copy the original Linked List.
None of the deep copied elements points the element of original Linked List.
Approach
Using object dictionary, store matching information of Linked List.
For example, key: Node -> value: Node.
After storing to dictionary, Node.random = dict.get(Node.random).
Problem
When a root node of Linked List is given, each node has next, random pointer,
deep copy the original Linked List.
None of the deep copied elements points the element of original Linked List.
Approach
Using object dictionary, store matching information of Linked List.
For example, key: Node -> value: Node.
After storing to dictionary, Node.random = dict.get(Node.random).
The code is below.
The text was updated successfully, but these errors were encountered: