creating divide and conquer methods in tree