From 2b27ba857b6763e2ee1c2be473b826d7085ff988 Mon Sep 17 00:00:00 2001 From: Ishika Chauhan <152597760+ishika1880@users.noreply.github.com> Date: Wed, 31 Jul 2024 22:26:22 +0530 Subject: [PATCH] Updated the inOrder and postOrder display methods In inOrder and postOrder display functions, instead of calling their own function, they are calling preOrder function --- .../20-trees/code/introduction/BinaryTree.java | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/lectures/20-trees/code/introduction/BinaryTree.java b/lectures/20-trees/code/introduction/BinaryTree.java index 366317961..56f15b31b 100644 --- a/lectures/20-trees/code/introduction/BinaryTree.java +++ b/lectures/20-trees/code/introduction/BinaryTree.java @@ -96,29 +96,29 @@ private void preOrder(Node node) { } public void inOrder() { - preOrder(root); + inOrder(root); } private void inOrder(Node node) { if (node == null) { return; } - preOrder(node.left); + inOrder(node.left); System.out.print(node.value + " "); - preOrder(node.right); + inOrder(node.right); } public void postOrder() { - preOrder(root); + postOrder(root); } private void postOrder(Node node) { if (node == null) { return; } - preOrder(node.left); - preOrder(node.right); + postOrder(node.left); + postOrder(node.right); System.out.print(node.value + " "); } -} \ No newline at end of file +}