Ledger Nano X - The secure hardware wallet


a guest Apr 8th, 2020 118 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. def DFS(G):
  2.     def DFSVisit(u):
  3.         for v in G[u]:
  4.             if parents[v]==-1:
  5.                 parents[v]=u
  6.                 DFSVisit(v)
  7.     parents=[-1]*len(G)
  8.     for v in range(len(G)):
  9.         if parents[v]==-1:
  10.             parents[v]=None
  11.             DFSVisit(v)
  12.     return parents
  13. G = [[1,2],[0,2,3],[3,1,0],[]]
  14. print( DFS(G) )
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand