From 94d4af7d916c0770d6824898efc7b017b91d5041 Mon Sep 17 00:00:00 2001 From: roylx <73628821+roylx@users.noreply.github.com> Date: Mon, 27 Feb 2023 13:51:47 -0700 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E6=AD=A3=E4=BA=86python=E7=89=88?= =?UTF-8?q?=E6=9C=AC=E7=9A=84=E7=A9=BA=E9=97=B4=E5=A4=8D=E6=9D=82=E5=BA=A6?= =?UTF-8?q?=E7=9A=84=E6=8F=8F=E8=BF=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- problems/0501.二叉搜索树中的众数.md | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/problems/0501.二叉搜索树中的众数.md b/problems/0501.二叉搜索树中的众数.md index cb14fb14..4214e232 100644 --- a/problems/0501.二叉搜索树中的众数.md +++ b/problems/0501.二叉搜索树中的众数.md @@ -476,6 +476,7 @@ class Solution { ## Python > 递归法 +> 常量空间,递归产生的栈不算 ```python # Definition for a binary tree node. @@ -521,7 +522,9 @@ class Solution: ``` -> 迭代法-中序遍历-不使用额外空间,利用二叉搜索树特性 +> 迭代法-中序遍历 +> 利用二叉搜索树特性,在历遍过程中更新结果,一次历遍 +> 但需要使用额外空间存储历遍的节点 ```python class Solution: def findMode(self, root: TreeNode) -> List[int]: