Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save jianminchen/221f05681dfb7eb5f1f3d2c0cf965fe2 to your computer and use it in GitHub Desktop.
Save jianminchen/221f05681dfb7eb5f1f3d2c0cf965fe2 to your computer and use it in GitHub Desktop.
Being an interviewer - work with a peer on May 19, 2018
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