Skip to content

Commit ef4ef42

Browse files
RANJEETJ06Ranjeet Kumar Jenasiriak
authored
Remove duplicated lines (TheAlgorithms#4258)
Co-authored-by: Ranjeet Kumar Jena <ranjeetjena06@gmai.com> Co-authored-by: Andrii Siriak <siryaka@gmail.com>
1 parent 3c80e26 commit ef4ef42

File tree

1 file changed

+4
-6
lines changed

1 file changed

+4
-6
lines changed

src/main/java/com/thealgorithms/datastructures/trees/BinaryTree.java

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
import java.util.LinkedList;
44
import java.util.Queue;
55

6-
/**
6+
/*
77
* This entire class is used to build a Binary Tree data structure. There is the
88
* Node Class and the Tree Class, both explained below.
99
*/
@@ -164,13 +164,11 @@ else if (temp.left != null && temp.right != null) {
164164
if (successor.right != null) {
165165
successor.right.parent = successor.parent;
166166
successor.parent.left = successor.right;
167-
successor.right = temp.right;
168-
successor.right.parent = successor;
169167
} else {
170168
successor.parent.left = null;
171-
successor.right = temp.right;
172-
successor.right.parent = successor;
173169
}
170+
successor.right = temp.right;
171+
successor.right.parent = successor;
174172
}
175173

176174
if (temp == root) {
@@ -304,7 +302,7 @@ public void postOrder(Node localRoot) {
304302
*/
305303
public void bfs(Node localRoot) {
306304
// Create a queue for the order of the nodes
307-
Queue<Node> queue = new LinkedList<Node>();
305+
Queue<Node> queue = new LinkedList<>();
308306

309307
// If the give root is null, then we don't add to the queue
310308
// and won't do anything

0 commit comments

Comments
 (0)