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 which, given a binary search tree of non-negative integers and an integer i, returns the next highest value in the tree, i.e. the smallest value in the tree that is greater than i. Return -1 if there are no values greater than i. Assume that all integers in the tree are unique. The value i may or may not be present in the tree. Your function should run in time O(h), where h is the height of the tree.
Write a method that determines how many values v in a binary search tree of unique integers fall in the range a ≤ v ≤ b, where a and b are function parameters. The function should run in time O(h + n), where h is the tree height and n is the number of integers in the range.
Write a method that takes a binary tree and returns true if the tree satisfies the ordering requirements of a binary search tree.
Write a method that takes a jagged array representing an undirected graph, and returns the number of connected components in the graph.
Write a method that takes a directed graph and two vertex ids v and w, and returns true if there is any path from v to w. Use a recursive depth-first search. If the search discovers w, return true immediately.