File tree 1 file changed +4
-6
lines changed
src/main/java/com/thealgorithms/datastructures/trees
1 file changed +4
-6
lines changed Original file line number Diff line number Diff line change 3
3
import java .util .LinkedList ;
4
4
import java .util .Queue ;
5
5
6
- /**
6
+ /*
7
7
* This entire class is used to build a Binary Tree data structure. There is the
8
8
* Node Class and the Tree Class, both explained below.
9
9
*/
@@ -164,13 +164,11 @@ else if (temp.left != null && temp.right != null) {
164
164
if (successor .right != null ) {
165
165
successor .right .parent = successor .parent ;
166
166
successor .parent .left = successor .right ;
167
- successor .right = temp .right ;
168
- successor .right .parent = successor ;
169
167
} else {
170
168
successor .parent .left = null ;
171
- successor .right = temp .right ;
172
- successor .right .parent = successor ;
173
169
}
170
+ successor .right = temp .right ;
171
+ successor .right .parent = successor ;
174
172
}
175
173
176
174
if (temp == root ) {
@@ -304,7 +302,7 @@ public void postOrder(Node localRoot) {
304
302
*/
305
303
public void bfs (Node localRoot ) {
306
304
// Create a queue for the order of the nodes
307
- Queue <Node > queue = new LinkedList <Node >();
305
+ Queue <Node > queue = new LinkedList <>();
308
306
309
307
// If the give root is null, then we don't add to the queue
310
308
// and won't do anything
You can’t perform that action at this time.
0 commit comments