static void Main(string[] args) { WriteLine("Calculate Height of a Tree in O(log n) time"); WriteLine(); WriteLine("Inserted Nodes: 20, 30, 10, 40, 60, 5"); BST root = null; BST bst = new BST(); root = bst.Insert(root, 20); root = bst.Insert(root, 30); root = bst.Insert(root, 10); root = bst.Insert(root, 40); root = bst.Insert(root, 60); root = bst.Insert(root, 5); WriteLine(); WriteLine(); WriteLine($"Height of a Tree is: {bst.Height(root)}"); WriteLine(); }
public BST(int _data) { this.data = _data; this.left = this.right = null; }