mirror of
https://github.com/krahets/hello-algo.git
synced 2025-11-01 20:12:07 +08:00
Rename the naming of the coding files
in backtracking algorithm. Add the typedef to docs.
This commit is contained in:
@ -1,5 +1,5 @@
|
||||
"""
|
||||
File: preorder_find_nodes.py
|
||||
File: find_nodes-preorder.py
|
||||
Created Time: 2023-04-15
|
||||
Author: Krahets (krahets@163.com)
|
||||
"""
|
||||
@ -11,7 +11,7 @@ from modules import *
|
||||
|
||||
|
||||
def pre_order(root: TreeNode) -> None:
|
||||
"""前序遍历"""
|
||||
"""前序遍历:例题一"""
|
||||
if root is None:
|
||||
return
|
||||
if root.val == 7:
|
||||
@ -1,5 +1,5 @@
|
||||
"""
|
||||
File: preorder_find_paths.py
|
||||
File: find_paths-preorder.py
|
||||
Created Time: 2023-04-15
|
||||
Author: Krahets (krahets@163.com)
|
||||
"""
|
||||
@ -11,7 +11,7 @@ from modules import *
|
||||
|
||||
|
||||
def pre_order(root: TreeNode) -> None:
|
||||
"""前序遍历"""
|
||||
"""前序遍历:例题二"""
|
||||
if root is None:
|
||||
return
|
||||
# 尝试
|
||||
@ -1,5 +1,5 @@
|
||||
"""
|
||||
File: preorder_find_constrained_path.py
|
||||
File: find_constrained_paths_template.py
|
||||
Created Time: 2023-04-15
|
||||
Author: Krahets (krahets@163.com)
|
||||
"""
|
||||
@ -11,7 +11,7 @@ from modules import *
|
||||
|
||||
|
||||
def pre_order(root: TreeNode) -> None:
|
||||
"""前序遍历"""
|
||||
"""前序遍历:例题三"""
|
||||
# 剪枝
|
||||
if root is None or root.val == 3:
|
||||
return
|
||||
@ -1,5 +1,5 @@
|
||||
"""
|
||||
File: backtrack_find_constrained_path.py
|
||||
File: find_constrained_paths_template.py
|
||||
Created Time: 2023-04-15
|
||||
Author: Krahets (krahets@163.com)
|
||||
"""
|
||||
@ -36,7 +36,7 @@ def undo_choice(state: list[TreeNode], choice: TreeNode):
|
||||
|
||||
|
||||
def backtrack(state: list[TreeNode], choices: list[TreeNode], res: list[list[TreeNode]]):
|
||||
"""回溯算法"""
|
||||
"""回溯算法:例题三"""
|
||||
# 检查是否为解
|
||||
if is_solution(state):
|
||||
# 记录解
|
||||
Reference in New Issue
Block a user