mirror of
https://github.com/krahets/hello-algo.git
synced 2025-12-19 07:17:54 +08:00
refactor: Replace 结点 with 节点 (#452)
* Replace 结点 with 节点 Update the footnotes in the figures * Update mindmap * Reduce the size of the mindmap.png
This commit is contained in:
@@ -16,7 +16,7 @@ public class binary_tree_dfs {
|
||||
/* 前序遍历 */
|
||||
static void preOrder(TreeNode root) {
|
||||
if (root == null) return;
|
||||
// 访问优先级:根结点 -> 左子树 -> 右子树
|
||||
// 访问优先级:根节点 -> 左子树 -> 右子树
|
||||
list.add(root.val);
|
||||
preOrder(root.left);
|
||||
preOrder(root.right);
|
||||
@@ -25,7 +25,7 @@ public class binary_tree_dfs {
|
||||
/* 中序遍历 */
|
||||
static void inOrder(TreeNode root) {
|
||||
if (root == null) return;
|
||||
// 访问优先级:左子树 -> 根结点 -> 右子树
|
||||
// 访问优先级:左子树 -> 根节点 -> 右子树
|
||||
inOrder(root.left);
|
||||
list.add(root.val);
|
||||
inOrder(root.right);
|
||||
@@ -34,7 +34,7 @@ public class binary_tree_dfs {
|
||||
/* 后序遍历 */
|
||||
static void postOrder(TreeNode root) {
|
||||
if (root == null) return;
|
||||
// 访问优先级:左子树 -> 右子树 -> 根结点
|
||||
// 访问优先级:左子树 -> 右子树 -> 根节点
|
||||
postOrder(root.left);
|
||||
postOrder(root.right);
|
||||
list.add(root.val);
|
||||
@@ -50,16 +50,16 @@ public class binary_tree_dfs {
|
||||
/* 前序遍历 */
|
||||
list.clear();
|
||||
preOrder(root);
|
||||
System.out.println("\n前序遍历的结点打印序列 = " + list);
|
||||
System.out.println("\n前序遍历的节点打印序列 = " + list);
|
||||
|
||||
/* 中序遍历 */
|
||||
list.clear();
|
||||
inOrder(root);
|
||||
System.out.println("\n中序遍历的结点打印序列 = " + list);
|
||||
System.out.println("\n中序遍历的节点打印序列 = " + list);
|
||||
|
||||
/* 后序遍历 */
|
||||
list.clear();
|
||||
postOrder(root);
|
||||
System.out.println("\n后序遍历的结点打印序列 = " + list);
|
||||
System.out.println("\n后序遍历的节点打印序列 = " + list);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user