예제 #1
0
        public Node3(T value, Node3 <T> left, Node3 <T> right)
        {
            Value = value;
            Left  = left;
            Right = right;

            left.Parent = right.Parent = this;
        }
예제 #2
0
        // change to Main to run.
        public static void Main(string[] args)
        {
            // in-order 213   // Left, Root, Right // clockwise
            // pre-order 123  // Root, Left, Right
            // post-order 231 // Left, Right, Root // counter-clockwise

            var root = new Node3 <int>(1, new Node3 <int>(2), new Node3 <int>(3));
            var tree = new BinaryTree2 <int>(root);


            Console.WriteLine(string.Join(",",
                                          tree.PreOrder.Select(x => x.Value))); // returns 1,2,3
        }
예제 #3
0
 public BinaryTree2(Node3 <T> root)
 {
     this.root = root;
 }