mirror of
https://github.com/krahets/hello-algo.git
synced 2026-07-12 07:26:07 +00:00
Rename the naming of the coding files
in backtracking algorithm. Add the typedef to docs.
This commit is contained in:
+3
-3
@@ -1,5 +1,5 @@
|
||||
/**
|
||||
* File: preorder_find_nodes.cs
|
||||
* File: preorder_traversal_i_compact.cs
|
||||
* Created Time: 2023-04-17
|
||||
* Author: hpstory (hpstory1024@163.com)
|
||||
*/
|
||||
@@ -10,11 +10,11 @@ using System.IO;
|
||||
|
||||
namespace hello_algo.chapter_backtracking;
|
||||
|
||||
public class preorder_find_nodes
|
||||
public class preorder_traversal_i_compact
|
||||
{
|
||||
static List<TreeNode> res;
|
||||
|
||||
/* 前序遍历 */
|
||||
/* 前序遍历:例题一 */
|
||||
static void preOrder(TreeNode root)
|
||||
{
|
||||
if (root == null)
|
||||
+3
-3
@@ -1,5 +1,5 @@
|
||||
/**
|
||||
* File: preorder_find_paths.cs
|
||||
* File: preorder_traversal_ii_compact.cs
|
||||
* Created Time: 2023-04-17
|
||||
* Author: hpstory (hpstory1024@163.com)
|
||||
*/
|
||||
@@ -9,12 +9,12 @@ using NUnit.Framework;
|
||||
|
||||
namespace hello_algo.chapter_backtracking;
|
||||
|
||||
public class preorder_find_paths
|
||||
public class preorder_traversal_ii_compact
|
||||
{
|
||||
static List<TreeNode> path;
|
||||
static List<List<TreeNode>> res;
|
||||
|
||||
/* 前序遍历 */
|
||||
/* 前序遍历:例题二 */
|
||||
static void preOrder(TreeNode root)
|
||||
{
|
||||
if (root == null)
|
||||
+3
-3
@@ -1,5 +1,5 @@
|
||||
/**
|
||||
* File: preorder_find_constrained_paths.cs
|
||||
* File: preorder_traversal_iii_compact.cs
|
||||
* Created Time: 2023-04-17
|
||||
* Author: hpstory (hpstory1024@163.com)
|
||||
*/
|
||||
@@ -9,12 +9,12 @@ using NUnit.Framework;
|
||||
|
||||
namespace hello_algo.chapter_backtracking;
|
||||
|
||||
public class preorder_find_constrained_paths
|
||||
public class preorder_traversal_iii_compact
|
||||
{
|
||||
static List<TreeNode> path;
|
||||
static List<List<TreeNode>> res;
|
||||
|
||||
/* 前序遍历 */
|
||||
/* 前序遍历:例题三 */
|
||||
static void preOrder(TreeNode root)
|
||||
{
|
||||
// 剪枝
|
||||
+3
-3
@@ -1,5 +1,5 @@
|
||||
/**
|
||||
* File: backtrack_find_constrained_paths.cs
|
||||
* File: preorder_traversal_iii_template.cs
|
||||
* Created Time: 2023-04-17
|
||||
* Author: hpstory (hpstory1024@163.com)
|
||||
*/
|
||||
@@ -9,7 +9,7 @@ using NUnit.Framework;
|
||||
|
||||
namespace hello_algo.chapter_backtracking;
|
||||
|
||||
public class backtrack_find_constrained_paths
|
||||
public class preorder_traversal_iii_template
|
||||
{
|
||||
/* 判断当前状态是否为解 */
|
||||
static bool isSolution(List<TreeNode> state)
|
||||
@@ -41,7 +41,7 @@ public class backtrack_find_constrained_paths
|
||||
state.RemoveAt(state.Count - 1);
|
||||
}
|
||||
|
||||
/* 回溯算法 */
|
||||
/* 回溯算法:例题三 */
|
||||
static void backtrack(List<TreeNode> state, List<TreeNode> choices, List<List<TreeNode>> res)
|
||||
{
|
||||
// 检查是否为解
|
||||
Reference in New Issue
Block a user