fix(csharp): Modify method name to PascalCase, simplify new expression (#840)

* Modify method name to PascalCase(array and linked list)

* Modify method name to PascalCase(backtracking)

* Modify method name to PascalCase(computational complexity)

* Modify method name to PascalCase(divide and conquer)

* Modify method name to PascalCase(dynamic programming)

* Modify method name to PascalCase(graph)

* Modify method name to PascalCase(greedy)

* Modify method name to PascalCase(hashing)

* Modify method name to PascalCase(heap)

* Modify method name to PascalCase(searching)

* Modify method name to PascalCase(sorting)

* Modify method name to PascalCase(stack and queue)

* Modify method name to PascalCase(tree)

* local check
This commit is contained in:
hpstory
2023-10-08 01:33:46 +08:00
committed by GitHub
parent 6f7e768cb7
commit f62256bee1
129 changed files with 1186 additions and 1192 deletions

View File

@ -7,32 +7,32 @@
namespace hello_algo.chapter_tree;
public class binary_tree_dfs {
List<int> list = new();
readonly List<int> list = new();
/* 前序遍历 */
void preOrder(TreeNode? root) {
void PreOrder(TreeNode? root) {
if (root == null) return;
// 访问优先级:根节点 -> 左子树 -> 右子树
list.Add(root.val);
preOrder(root.left);
preOrder(root.right);
PreOrder(root.left);
PreOrder(root.right);
}
/* 中序遍历 */
void inOrder(TreeNode? root) {
void InOrder(TreeNode? root) {
if (root == null) return;
// 访问优先级:左子树 -> 根节点 -> 右子树
inOrder(root.left);
InOrder(root.left);
list.Add(root.val);
inOrder(root.right);
InOrder(root.right);
}
/* 后序遍历 */
void postOrder(TreeNode? root) {
void PostOrder(TreeNode? root) {
if (root == null) return;
// 访问优先级:左子树 -> 右子树 -> 根节点
postOrder(root.left);
postOrder(root.right);
PostOrder(root.left);
PostOrder(root.right);
list.Add(root.val);
}
@ -45,15 +45,15 @@ public class binary_tree_dfs {
PrintUtil.PrintTree(root);
list.Clear();
preOrder(root);
PreOrder(root);
Console.WriteLine("\n前序遍历的节点打印序列 = " + string.Join(",", list));
list.Clear();
inOrder(root);
InOrder(root);
Console.WriteLine("\n中序遍历的节点打印序列 = " + string.Join(",", list));
list.Clear();
postOrder(root);
PostOrder(root);
Console.WriteLine("\n后序遍历的节点打印序列 = " + string.Join(",", list));
}
}