Skip to content

Commit 7063bc0

Browse files
committed
修正内容错误
1 parent 426f76c commit 7063bc0

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

docs/solutions/0100-0199/convert-sorted-array-to-binary-search-tree.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -67,5 +67,5 @@ class Solution:
6767

6868
### 思路 1:复杂度分析
6969

70-
- **时间复杂度**:$O(n)$。其中 $n$ 是数组的长度。
71-
- **空间复杂度**:$O(n)$。
70+
- **时间复杂度**:$O(n)$。其中 $n$ 是数组的长度。递归过程中每个元素只会被访问一次并构造成树节点,因此总的时间复杂度为 $O(n)$。
71+
- **空间复杂度**:$O(\log n)$。不考虑返回的树结构所占空间,仅计算递归栈空间)。由于每次递归都将区间一分为二,递归深度为二叉树的高度,最平衡情况下高度为 $O(\log n)$,因此递归栈的最大深度为 $O(\log n)$。如果将返回的整棵树节点空间也计入,则空间复杂度为 $O(n)$。

0 commit comments

Comments
 (0)