我对来自 Leetscode.com 的这个问题感到困惑,这个算法是自上而下还是自上而下?
public static TreeNode addToTree(int arr[], int start, int end){
if (end < start) {
return null;
}
int mid = (start + end) / 2;
TreeNode n = new TreeNode(arr[mid]);
n.left = addToTree(arr, start, mid - 1);
n.right = addToTree(arr, mid + 1, end);
return n;
}
谢谢