Example #1
0
		public static List<TreeNode> FindTreeNodes(TreeNode root, TreeNodeFindPredicate predicate) {
			List<TreeNode> result = new List<TreeNode>();
			FindTreeNodesRecursive(root, predicate, result);
			return result;
		}
Example #2
0
		private static void FindTreeNodesRecursive(TreeNode n, TreeNodeFindPredicate predicate, List<TreeNode> arr) {
			if (predicate(n))
				arr.Add(n);
			for (int i = 0; i < n.children.Count; i++)
				FindTreeNodesRecursive(n.children[i], predicate, arr);
		}