static void Main() { AugmentedTree<int> tree = new AugmentedTree<int>(); tree.Insert(1, 10); tree.Insert(19, 20); tree.Insert(0, 2); tree.Insert(-1, 4); tree.Insert(4, 11); tree.Insert(30, 60); Console.WriteLine(tree.Search(5, 11)); }
private void EnqueueElement(TreeNode tree, Queue <AugmentedTree> queue, int level) { var node = new AugmentedTree() { Level = level }; queue.Enqueue(node); if (tree != null) { node.Tree = tree; } }
public int MaxPathSum(TreeNode root) { var r = new AugmentedTree(root); return((int)r.MaxSumSoFar); }