Skip to content

Commit 4721cff

Browse files
made requested changes for binary tree implementation
1 parent 2eec474 commit 4721cff

File tree

2 files changed

+7
-7
lines changed

2 files changed

+7
-7
lines changed

src/main/java/com/dataStructures/BinaryTree.java

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
package dataStructures;
1+
package src.main.java.com.dataStructures;
22

33
/**
44
* Binary tree for general value type, without redundancy
@@ -76,7 +76,7 @@ public BinaryTree search(T data){
7676
* @return true if this tree contains the data value, false if not.
7777
*/
7878
public boolean contains(T data){
79-
return !(this.search(data) == null);
79+
return this.search(data) != null;
8080
}
8181

8282
/**
@@ -89,10 +89,10 @@ private void print(int tabCounter){
8989

9090
System.out.println(this);
9191

92-
if (this.left!=null)
93-
this.left.print(tabCounter+1); //it can't be ++ , pls don't change it
94-
if (this.right!=null)
95-
this.right.print(tabCounter+1); //it can't be ++ , pls don't change it
92+
if (this.left != null)
93+
this.left.print(tabCounter + 1); //it can't be ++ , pls don't change it
94+
if (this.right != null)
95+
this.right.print(tabCounter + 1); //it can't be ++ , pls don't change it
9696
}
9797

9898
/**

src/test/java/com/dataStructures/BinaryTreeTest.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
package dataStructures;
1+
package src.main.java.com.dataStructures;
22

33
import org.junit.Test;
44
import static org.junit.Assert.*;

0 commit comments

Comments
 (0)