My Blog List

[Leetcode Solution] Clone Graph

Analysis

  • Just the same as clone a linked list
  • Using recursive method to traversal each node with a hashmap
  • If one node has already been in the hash which means has been visited, just return node's pointer
  • Else create a new node and insert it into hash, and recursively build all of its neighbors

Code


1 comment:

  1. I am regular visitor, how are you everybody? This article posted at this site is actually nice.


    Here is my webpage ... hair system prices

    ReplyDelete

Enter you comment