Skip to content

Files

Latest commit

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

History

History

clone-n-ary-tree

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]

Similar Questions

  1. Clone Graph (Medium)
  2. Copy List with Random Pointer (Medium)
  3. Clone Binary Tree With Random Pointer (Medium)

Hints

Hint 1 Traverse the tree, keep a hashtable with you and create a clone node for each node in the tree.
Hint 2 Start traversing the original tree again and connect each child pointer in the cloned tree the same way as the original tree with the help of the hashtable.