Format the Java codes with the Reat Hat extension.

This commit is contained in:
krahets
2023-04-14 00:12:10 +08:00
parent 7273ee24e8
commit f8513455b5
39 changed files with 195 additions and 205 deletions

View File

@ -15,7 +15,8 @@ public class binary_tree_dfs {
/* 前序遍历 */
static void preOrder(TreeNode root) {
if (root == null) return;
if (root == null)
return;
// 访问优先级:根节点 -> 左子树 -> 右子树
list.add(root.val);
preOrder(root.left);
@ -24,7 +25,8 @@ public class binary_tree_dfs {
/* 中序遍历 */
static void inOrder(TreeNode root) {
if (root == null) return;
if (root == null)
return;
// 访问优先级:左子树 -> 根节点 -> 右子树
inOrder(root.left);
list.add(root.val);
@ -33,7 +35,8 @@ public class binary_tree_dfs {
/* 后序遍历 */
static void postOrder(TreeNode root) {
if (root == null) return;
if (root == null)
return;
// 访问优先级:左子树 -> 右子树 -> 根节点
postOrder(root.left);
postOrder(root.right);