Skip to content

Commit df60970

Browse files
committed
update complexity
1 parent 96c50c3 commit df60970

File tree

1 file changed

+2
-2
lines changed
  • lowest-common-ancestor-of-a-binary-search-tree

1 file changed

+2
-2
lines changed

lowest-common-ancestor-of-a-binary-search-tree/hyer0705.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,8 +11,8 @@
1111
* }
1212
* }
1313
*
14-
* Time Complexity: O(h) where h is the height of the tree
15-
* Space Complexity: O(1)
14+
* Time Complexity: O(logn) in average, O(n) in the worst case
15+
* Space Complexity: O(logn) in average, O(n) in the worst case
1616
*/
1717
function lowestCommonAncestor(root: TreeNode | null, p: TreeNode | null, q: TreeNode | null): TreeNode | null {
1818
if (p.val < root.val && q.val < root.val) {

0 commit comments

Comments
 (0)