Created
May 20, 2018 03:56
-
-
Save jianminchen/221f05681dfb7eb5f1f3d2c0cf965fe2 to your computer and use it in GitHub Desktop.
Being an interviewer - work with a peer on May 19, 2018
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
1->2->3->4 singly linked list | |
every node has a random pointer -> | |
1->3 // random pointer -> copy it | |
2->1 | |
3->null | |
4->null | |
1->2->3->4 | |
1->3 | |
1->2->3->4 | |
1 | |
public static Node copySinglyLinedListRandomPoint(Node root, Node copy) | |
{ | |
// traverse trhough the root and find the random pointers of every node | |
// for every node i need to find that random pointer node in the copy list | |
Node r = root.random; | |
while( root!=null){ | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment