Ejemplo n.º 1
0
 private static void DFS(TreeNode node)
 {
     currentPath.Push(node.Value);
     if (node.Value == M)
     {
         if (allPaths.Count == 0 || currentPath.Count < allPaths[0].Count())
         {
             allPaths.Add(currentPath.ToArray());
         }
     }
     foreach (var child in node.Children)
     {
         DFS(child);
     }
     currentPath.Pop();
 }
Ejemplo n.º 2
0
 public Tree(int value)
 {
     this.root = new TreeNode(value);
 }
Ejemplo n.º 3
0
 public void AddChild(TreeNode child)
 {
     this.children.Add(child);
 }