public void InOrderBST(Node root)
 {
     if (root != null)
         {
             InOrderBST(root.left);
             Console.WriteLine(root.data + " ");
             InOrderBST(root.right);
         }
 }
 public void BreadthBST(Node root)
 {
     Node start;
         Queue<Node> bread = new Queue<Node>();
         bread.Enqueue(root);
         while(bread.Count != 0){
             start = bread.Dequeue();
             Console.WriteLine(start.data+ " ");
             if (start.left != null)
             {
                 bread.Enqueue(start.left);
             }
             if (start.right != null)
             {
                 bread.Enqueue(start.right);
             }
         }
 }
 public Node(int data)
 {
     this.data = data;
         left = null;
         right = null;
 }
        static void Main(string[] args)
        {
            Node root = new Node(22);
            root.InsertNode(33);
            root.InsertNode(5);
            root.InsertNode(6);
            root.InsertNode(8);
            root.InsertNode(38);
            root.InsertNode(30);
            root.InsertNode(4);

            Console.WriteLine("Pre-order First Search");
            root.PreOrderBST(root);

            Console.WriteLine("In-order First Search");
            root.InOrderBST(root);

            Console.WriteLine("Post-order First Search");
            root.PostOrderBST(root);

            Console.WriteLine("Breadth-first Search");
            root.BreadthBST(root);
        }