Update 0700.二叉搜索树中的搜索.md

This commit is contained in:
jianghongcheng
2023-05-09 18:50:14 -05:00
committed by GitHub
parent a45046be8a
commit 3818de4610

View File

@ -230,7 +230,7 @@ class Solution {
### Python
递归法:
(方法一) 递归
```python
class Solution:
@ -250,12 +250,12 @@ class Solution:
```
迭代法:
(方法二)迭代
```python
class Solution:
def searchBST(self, root: TreeNode, val: int) -> TreeNode:
while root is not None:
while root:
if val < root.val: root = root.left
elif val > root.val: root = root.right
else: return root