added tree data structure and max sum path