Consider this program:
static void Main(string[] args) {
int sum = 0;
for (int i = 1 ; i != 0; ++i)
sum += i;
WriteLine(sum);
}What value do you think it will print? Why?
Write a method that takes an array containing a sorted list of integers and returns a binary search tree containing all the values in the array. The tree should be as balanced as possible, i.e. it should have the minimum possible height.
Write a method that takes a binary tree and returns true if the tree satisfies the ordering requirements of a binary search tree.