Binary Search Trees and related problems