Skip to content

Conversation

abircb
Copy link

@abircb abircb commented Apr 15, 2019

Implemented the DepthFirstSearch in Java by creating a Binary Tree class and adding appropriate 'add' and 'get' methods. Also added a JUnit test :)

abircb added 3 commits April 15, 2019 11:14
this test is created for the DepthFirstSearch.java file- that I added- containing the DepthFirstSearch algorithm
Update DepthFirstSearch.java - signature removed, and whitespaces resolved

Co-Authored-By: Libin Yang <contact@yanglibin.info>
@yanglbme yanglbme merged commit af6daf7 into TheAlgorithms:Development May 11, 2019
import org.junit.Assert;
import org.junit.Test;
import src.main.java.com.search.DepthFirstSearch;
import src.main.java.com.search.BinaryTree;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

'src.main.java.com.search.BinaryTree' is not public in 'src.main.java.com.search'. Cannot be accessed from outside package.

Assert.assertEquals("Incorrect index", null, DepthFirstSearch.find(8, tree1));
Assert.assertEquals("Incorrect index", null, DepthFirstSearch.find(-2, tree1));

BinaryTree<String> tree2 = new BinaryTree<String>();
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
BinaryTree<String> tree2 = new BinaryTree<String>();
BinaryTree<String> tree2 = new BinaryTree<>();

@Test
public void testDepthFirstSearch() {

BinaryTree<Integer> tree1 = new BinaryTree<Integer>();
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
BinaryTree<Integer> tree1 = new BinaryTree<Integer>();
BinaryTree<Integer> tree1 = new BinaryTree<>();

@yanglbme
Copy link
Member

Hi @abircb, I've revert the PR Added DepthFirstSearch.java and DepthFirstTestSearch.java #737

You can open a new pull request after fixing the problems.

@abircb
Copy link
Author

abircb commented May 20, 2019

Hi @yanglbme, I've just opened a new pull request- please check it out. And thanks for all the valuable feedback :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants