mirror of
https://github.com/CyC2018/Interview-Notebook.git
synced 2026-10-31 19:13:42 +00:00
Update Leetcode 题解 - 树.md
补充最近公共祖先的时间与空间复杂度。
This commit is contained in:
@@ -906,6 +906,8 @@ public TreeNode lowestCommonAncestor(TreeNode root, TreeNode p, TreeNode q) {
|
||||
}
|
||||
```
|
||||
|
||||
每个节点最多访问一次,时间复杂度 O(N);递归深度最多为树的高度 H,空间复杂度 O(H),树退化成链时最坏为 O(N)。
|
||||
|
||||
### 6. 从有序数组中构造二叉查找树
|
||||
|
||||
108\. Convert Sorted Array to Binary Search Tree (Easy)
|
||||
|
||||
Reference in New Issue
Block a user