Skip to content

Files

Latest commit

author
Shuo
Feb 16, 2022
ce6b544 · Feb 16, 2022

History

History

clone-binary-tree-with-random-pointer

Folders and files

NameName
Last commit message
Last commit date

parent directory

..
Feb 16, 2022

README.md

< Previous                  Next >

Related Topics

[Hash Table] [Tree] [Depth-First Search] [Breadth-First Search] [Binary Tree]

Similar Questions

  1. Clone Graph (Medium)
  2. Copy List with Random Pointer (Medium)
  3. Clone N-ary Tree (Medium)

Hints

Hint 1 Traverse the tree, keep a hashtable with you and create a nodecopy for each node in the tree.
Hint 2 Start traversing the original tree again and connect the left, right and random pointers in the cloned tree the same way as the original tree with the help of the hashtable.