diff --git a/.gitignore b/.gitignore
index d0efd57..0a6bfdb 100644
--- a/.gitignore
+++ b/.gitignore
@@ -28,4 +28,18 @@
/DataStructures/Stack/dist/
/Algorithms/DepthFirstSearch/build/
/Algorithms/BreadthFirstSearch/nbproject/private/
-/Algorithms/BreadthFirstSearch/build/
\ No newline at end of file
+/Algorithms/BreadthFirstSearch/build/
+/Algorithms/Graph/Dijkstra/dist/
+/DataStructures/BinaryTree/dist/
+/Algorithms/Search/BinarySearch/nbproject/private/
+/Algorithms/Search/BinarySearch/build/
+/Algorithms/Search/BreadthFirstSearch/build/
+/Algorithms/Search/BreadthFirstSearch/nbproject/private/
+/Algorithms/Search/DepthFirstSearch/build/
+/Algorithms/Search/DepthFirstSearch/nbproject/private/
+/Algorithms/Traversal/BreadthFirstTraverse/nbproject/private/
+/Algorithms/Traversal/DepthFirstTraverse/nbproject/private/
+/Algorithms/Traversal/BreadthFirstTraverse/build/
+/Algorithms/Traversal/DepthFirstTraverse/build/
+/Algorithms/Sort/CountingSort/nbproject/private/
+/Algorithms/Sort/CountingSort/build/
\ No newline at end of file
diff --git a/Algorithms/Dijkstra/README.md b/Algorithms/Graph/Dijkstra/README.md
similarity index 100%
rename from Algorithms/Dijkstra/README.md
rename to Algorithms/Graph/Dijkstra/README.md
diff --git a/Algorithms/Dijkstra/build.xml b/Algorithms/Graph/Dijkstra/build.xml
similarity index 100%
rename from Algorithms/Dijkstra/build.xml
rename to Algorithms/Graph/Dijkstra/build.xml
diff --git a/Algorithms/Graph/Dijkstra/build/built-jar.properties b/Algorithms/Graph/Dijkstra/build/built-jar.properties
new file mode 100644
index 0000000..61e3152
--- /dev/null
+++ b/Algorithms/Graph/Dijkstra/build/built-jar.properties
@@ -0,0 +1,4 @@
+#Fri, 08 Feb 2019 14:25:24 -0500
+
+
+C\:\\Users\\yashs\\Documents\\Projects\\Java\\Algorithms\\Graph\\Dijkstra=
diff --git a/Algorithms/Graph/Dijkstra/build/classes/.netbeans_automatic_build b/Algorithms/Graph/Dijkstra/build/classes/.netbeans_automatic_build
new file mode 100644
index 0000000..e69de29
diff --git a/Algorithms/Graph/Dijkstra/build/classes/.netbeans_update_resources b/Algorithms/Graph/Dijkstra/build/classes/.netbeans_update_resources
new file mode 100644
index 0000000..e69de29
diff --git a/Algorithms/Graph/Dijkstra/build/classes/dijkstra/Dijkstra.class b/Algorithms/Graph/Dijkstra/build/classes/dijkstra/Dijkstra.class
new file mode 100644
index 0000000..e554eee
Binary files /dev/null and b/Algorithms/Graph/Dijkstra/build/classes/dijkstra/Dijkstra.class differ
diff --git a/Algorithms/Graph/Dijkstra/build/test/classes/.netbeans_automatic_build b/Algorithms/Graph/Dijkstra/build/test/classes/.netbeans_automatic_build
new file mode 100644
index 0000000..e69de29
diff --git a/Algorithms/Graph/Dijkstra/build/test/classes/.netbeans_update_resources b/Algorithms/Graph/Dijkstra/build/test/classes/.netbeans_update_resources
new file mode 100644
index 0000000..e69de29
diff --git a/Algorithms/Graph/Dijkstra/build/test/classes/dijkstra/DijkstraTest.class b/Algorithms/Graph/Dijkstra/build/test/classes/dijkstra/DijkstraTest.class
new file mode 100644
index 0000000..b92236c
Binary files /dev/null and b/Algorithms/Graph/Dijkstra/build/test/classes/dijkstra/DijkstraTest.class differ
diff --git a/Algorithms/Graph/Dijkstra/build/test/classes/dijkstra/sample.PNG b/Algorithms/Graph/Dijkstra/build/test/classes/dijkstra/sample.PNG
new file mode 100644
index 0000000..ac49dbe
Binary files /dev/null and b/Algorithms/Graph/Dijkstra/build/test/classes/dijkstra/sample.PNG differ
diff --git a/Algorithms/BreadthFirstSearch/manifest.mf b/Algorithms/Graph/Dijkstra/manifest.mf
similarity index 100%
rename from Algorithms/BreadthFirstSearch/manifest.mf
rename to Algorithms/Graph/Dijkstra/manifest.mf
diff --git a/Algorithms/Dijkstra/nbproject/build-impl.xml b/Algorithms/Graph/Dijkstra/nbproject/build-impl.xml
similarity index 100%
rename from Algorithms/Dijkstra/nbproject/build-impl.xml
rename to Algorithms/Graph/Dijkstra/nbproject/build-impl.xml
diff --git a/Algorithms/Dijkstra/nbproject/genfiles.properties b/Algorithms/Graph/Dijkstra/nbproject/genfiles.properties
similarity index 100%
rename from Algorithms/Dijkstra/nbproject/genfiles.properties
rename to Algorithms/Graph/Dijkstra/nbproject/genfiles.properties
diff --git a/Algorithms/Graph/Dijkstra/nbproject/private/config.properties b/Algorithms/Graph/Dijkstra/nbproject/private/config.properties
new file mode 100644
index 0000000..e69de29
diff --git a/Algorithms/Graph/Dijkstra/nbproject/private/private.properties b/Algorithms/Graph/Dijkstra/nbproject/private/private.properties
new file mode 100644
index 0000000..5abd886
--- /dev/null
+++ b/Algorithms/Graph/Dijkstra/nbproject/private/private.properties
@@ -0,0 +1,10 @@
+compile.on.save=true
+do.depend=false
+do.jar=true
+do.jlink=false
+file.reference.CustomException.jar=C:\\Users\\yashs\\Documents\\Projects\\Java\\CustomException\\dist\\CustomException.jar
+file.reference.Graph.jar=C:\\Users\\yashs\\Documents\\Projects\\Java\\DataStructures\\Graph\\dist\\Graph.jar
+javac.debug=true
+javadoc.preview=true
+jlink.strip=false
+user.properties.file=C:\\Users\\yashs\\AppData\\Roaming\\NetBeans\\10.0\\build.properties
diff --git a/Algorithms/Graph/Dijkstra/nbproject/private/private.xml b/Algorithms/Graph/Dijkstra/nbproject/private/private.xml
new file mode 100644
index 0000000..6807a2b
--- /dev/null
+++ b/Algorithms/Graph/Dijkstra/nbproject/private/private.xml
@@ -0,0 +1,7 @@
+
+
+
+
+
+
+
diff --git a/Algorithms/Dijkstra/nbproject/project.properties b/Algorithms/Graph/Dijkstra/nbproject/project.properties
similarity index 100%
rename from Algorithms/Dijkstra/nbproject/project.properties
rename to Algorithms/Graph/Dijkstra/nbproject/project.properties
diff --git a/Algorithms/Dijkstra/nbproject/project.xml b/Algorithms/Graph/Dijkstra/nbproject/project.xml
similarity index 100%
rename from Algorithms/Dijkstra/nbproject/project.xml
rename to Algorithms/Graph/Dijkstra/nbproject/project.xml
diff --git a/Algorithms/Dijkstra/src/dijkstra/Dijkstra.java b/Algorithms/Graph/Dijkstra/src/dijkstra/Dijkstra.java
similarity index 100%
rename from Algorithms/Dijkstra/src/dijkstra/Dijkstra.java
rename to Algorithms/Graph/Dijkstra/src/dijkstra/Dijkstra.java
diff --git a/Algorithms/Dijkstra/test/dijkstra/DijkstraTest.java b/Algorithms/Graph/Dijkstra/test/dijkstra/DijkstraTest.java
similarity index 100%
rename from Algorithms/Dijkstra/test/dijkstra/DijkstraTest.java
rename to Algorithms/Graph/Dijkstra/test/dijkstra/DijkstraTest.java
diff --git a/Algorithms/Graph/Dijkstra/test/dijkstra/sample.PNG b/Algorithms/Graph/Dijkstra/test/dijkstra/sample.PNG
new file mode 100644
index 0000000..ac49dbe
Binary files /dev/null and b/Algorithms/Graph/Dijkstra/test/dijkstra/sample.PNG differ
diff --git a/Algorithms/Graph/README.md b/Algorithms/Graph/README.md
new file mode 100644
index 0000000..cb7d62e
--- /dev/null
+++ b/Algorithms/Graph/README.md
@@ -0,0 +1,4 @@
+**This repository contains different types of graph algorithms written in Java programming language**
+
+## List of projects ##
+1. [Dijkstra's Single-Source Shortest Path](https://github.com/yashshah03/Java/tree/master/Algorithms/Graph/Dijkstra)
diff --git a/Algorithms/README.md b/Algorithms/README.md
index 4ecbb42..49f0918 100644
--- a/Algorithms/README.md
+++ b/Algorithms/README.md
@@ -1,6 +1,14 @@
-**This repository contains Algorithms written in Java programming language**
+**This repository contains different types of traversal Algorithms written in Java programming language**
## List of projects ##
- 1. [Breadth First Search Algorithm](https://github.com/yashshah03/Java/tree/master/Algorithms/BreadthFirstSearch)
- 2. [Depth First Search Algorithm](https://github.com/yashshah03/Java/tree/master/Algorithms/DepthFirstSearch)
- 1. [Dijkstra's Algorithm](https://github.com/yashshah03/Java/tree/master/Algorithms/Dijkstra)
\ No newline at end of file
+1. [Traversal](https://github.com/yashshah03/Java/tree/master/Algorithms/Traversal)
+ 1. [Breadth First Traversal](https://github.com/yashshah03/Java/tree/master/Algorithms/Traversal/BreadthFirstTraverse)
+ 2. [Depth First Traversal](https://github.com/yashshah03/Java/tree/master/Algorithms/Traversal/DepthFirstTraverse)
+2. [Graph](https://github.com/yashshah03/Java/tree/master/Algorithms/Graph)
+ 1. [Dijkstra's Single-Source Shortest Path](https://github.com/yashshah03/Java/tree/master/Algorithms/Graph/Dijkstra)
+3. [Search](https://github.com/yashshah03/Java/tree/master/Algorithms/Search)
+ 1. [Binary Search](https://github.com/yashshah03/Java/tree/master/Algorithms/Search/BinarySearch)
+ 2. [Breadth First Search](https://github.com/yashshah03/Java/tree/master/Algorithms/Search/BreadthFirstSearch)
+ 3. [Depth First Search](https://github.com/yashshah03/Java/tree/master/Algorithms/Search/DepthFirstSearch)
+4. [Sort](https://github.com/yashshah03/Java/tree/master/Algorithms/Sort)
+ 1. [Counting Sort](https://github.com/yashshah03/Java/tree/master/Algorithms/Sort/CountingSort)
\ No newline at end of file
diff --git a/Algorithms/Search/BinarySearch/README.md b/Algorithms/Search/BinarySearch/README.md
new file mode 100644
index 0000000..825f6c6
--- /dev/null
+++ b/Algorithms/Search/BinarySearch/README.md
@@ -0,0 +1,10 @@
+## This project contains sample implementation of Binary Search Algorithm in java
+**The project is developed using Apache Netbeans IDE 10.0, Java 8, Windows 10**
+
+## Constraints:
+- The input array needs to be sorted in Ascending order.
+
+## Methods:
+ - search(input, number)
+ * Searches for the given number in input array
+
diff --git a/Algorithms/Search/BinarySearch/build.xml b/Algorithms/Search/BinarySearch/build.xml
new file mode 100644
index 0000000..ce11ac8
--- /dev/null
+++ b/Algorithms/Search/BinarySearch/build.xml
@@ -0,0 +1,73 @@
+
+
+
+
+
+
+
+
+
+
+ Builds, tests, and runs the project BinarySearch.
+
+
+
diff --git a/Algorithms/DepthFirstSearch/manifest.mf b/Algorithms/Search/BinarySearch/manifest.mf
similarity index 100%
rename from Algorithms/DepthFirstSearch/manifest.mf
rename to Algorithms/Search/BinarySearch/manifest.mf
diff --git a/Algorithms/Search/BinarySearch/nbproject/build-impl.xml b/Algorithms/Search/BinarySearch/nbproject/build-impl.xml
new file mode 100644
index 0000000..fdb64a7
--- /dev/null
+++ b/Algorithms/Search/BinarySearch/nbproject/build-impl.xml
@@ -0,0 +1,1768 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Must set src.dir
+ Must set test.src.dir
+ Must set build.dir
+ Must set dist.dir
+ Must set build.classes.dir
+ Must set dist.javadoc.dir
+ Must set build.test.classes.dir
+ Must set build.test.results.dir
+ Must set build.classes.excludes
+ Must set dist.jar
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Must set javac.includes
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ No tests executed.
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Must set JVM to use for profiling in profiler.info.jvm
+ Must set profiler agent JVM arguments in profiler.info.jvmargs.agent
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Must select some files in the IDE or set javac.includes
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ To run this application from the command line without Ant, try:
+
+ java -jar "${dist.jar.resolved}"
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Must select one file in the IDE or set run.class
+
+
+
+ Must select one file in the IDE or set run.class
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Must select one file in the IDE or set debug.class
+
+
+
+
+ Must select one file in the IDE or set debug.class
+
+
+
+
+ Must set fix.includes
+
+
+
+
+
+
+
+
+
+ This target only works when run from inside the NetBeans IDE.
+
+
+
+
+
+
+
+
+ Must select one file in the IDE or set profile.class
+ This target only works when run from inside the NetBeans IDE.
+
+
+
+
+
+
+
+
+ This target only works when run from inside the NetBeans IDE.
+
+
+
+
+
+
+
+
+
+
+
+
+ This target only works when run from inside the NetBeans IDE.
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Must select one file in the IDE or set run.class
+
+
+
+
+
+ Must select some files in the IDE or set test.includes
+
+
+
+
+ Must select one file in the IDE or set run.class
+
+
+
+
+ Must select one file in the IDE or set applet.url
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Must select some files in the IDE or set javac.includes
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Some tests failed; see details above.
+
+
+
+
+
+
+
+
+ Must select some files in the IDE or set test.includes
+
+
+
+ Some tests failed; see details above.
+
+
+
+ Must select some files in the IDE or set test.class
+ Must select some method in the IDE or set test.method
+
+
+
+ Some tests failed; see details above.
+
+
+
+
+ Must select one file in the IDE or set test.class
+
+
+
+ Must select one file in the IDE or set test.class
+ Must select some method in the IDE or set test.method
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Must select one file in the IDE or set applet.url
+
+
+
+
+
+
+
+
+ Must select one file in the IDE or set applet.url
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/Algorithms/Search/BinarySearch/nbproject/genfiles.properties b/Algorithms/Search/BinarySearch/nbproject/genfiles.properties
new file mode 100644
index 0000000..74d844b
--- /dev/null
+++ b/Algorithms/Search/BinarySearch/nbproject/genfiles.properties
@@ -0,0 +1,8 @@
+build.xml.data.CRC32=3efad8db
+build.xml.script.CRC32=0d1c8b5f
+build.xml.stylesheet.CRC32=f85dc8f2@1.90.1.48
+# This file is used by a NetBeans-based IDE to track changes in generated files such as build-impl.xml.
+# Do not edit this file. You may delete it but then the IDE will never regenerate such files for you.
+nbproject/build-impl.xml.data.CRC32=3efad8db
+nbproject/build-impl.xml.script.CRC32=0cb28ea2
+nbproject/build-impl.xml.stylesheet.CRC32=3a2fa800@1.90.1.48
diff --git a/Algorithms/Search/BinarySearch/nbproject/project.properties b/Algorithms/Search/BinarySearch/nbproject/project.properties
new file mode 100644
index 0000000..f631d93
--- /dev/null
+++ b/Algorithms/Search/BinarySearch/nbproject/project.properties
@@ -0,0 +1,100 @@
+annotation.processing.enabled=true
+annotation.processing.enabled.in.editor=false
+annotation.processing.processor.options=
+annotation.processing.processors.list=
+annotation.processing.run.all.processors=true
+annotation.processing.source.output=${build.generated.sources.dir}/ap-source-output
+build.classes.dir=${build.dir}/classes
+build.classes.excludes=**/*.java,**/*.form
+# This directory is removed when the project is cleaned:
+build.dir=build
+build.generated.dir=${build.dir}/generated
+build.generated.sources.dir=${build.dir}/generated-sources
+# Only compile against the classpath explicitly listed here:
+build.sysclasspath=ignore
+build.test.classes.dir=${build.dir}/test/classes
+build.test.results.dir=${build.dir}/test/results
+# Uncomment to specify the preferred debugger connection transport:
+#debug.transport=dt_socket
+debug.classpath=\
+ ${run.classpath}
+debug.modulepath=\
+ ${run.modulepath}
+debug.test.classpath=\
+ ${run.test.classpath}
+debug.test.modulepath=\
+ ${run.test.modulepath}
+# Files in build.classes.dir which should be excluded from distribution jar
+dist.archive.excludes=
+# This directory is removed when the project is cleaned:
+dist.dir=dist
+dist.jar=${dist.dir}/BinarySearch.jar
+dist.javadoc.dir=${dist.dir}/javadoc
+dist.jlink.dir=${dist.dir}/jlink
+dist.jlink.output=${dist.jlink.dir}/BinarySearch
+excludes=
+file.reference.hamcrest-core-1.3.jar=C:\\Users\\yashs\\Documents\\netbeans\\platform\\modules\\ext\\hamcrest-core-1.3.jar
+file.reference.junit-4.12.jar=C:\\Users\\yashs\\Documents\\netbeans\\platform\\modules\\ext\\junit-4.12.jar
+includes=**
+jar.compress=false
+javac.classpath=\
+ ${file.reference.hamcrest-core-1.3.jar}:\
+ ${file.reference.junit-4.12.jar}
+# Space-separated list of extra javac options
+javac.compilerargs=
+javac.deprecation=false
+javac.external.vm=true
+javac.modulepath=
+javac.processormodulepath=
+javac.processorpath=\
+ ${javac.classpath}
+javac.source=1.8
+javac.target=1.8
+javac.test.classpath=\
+ ${javac.classpath}:\
+ ${build.classes.dir}:\
+ ${libs.junit_5.classpath}
+javac.test.modulepath=\
+ ${javac.modulepath}
+javac.test.processorpath=\
+ ${javac.test.classpath}
+javadoc.additionalparam=
+javadoc.author=false
+javadoc.encoding=${source.encoding}
+javadoc.html5=false
+javadoc.noindex=false
+javadoc.nonavbar=false
+javadoc.notree=false
+javadoc.private=false
+javadoc.splitindex=true
+javadoc.use=true
+javadoc.version=false
+javadoc.windowtitle=
+# The jlink additional root modules to resolve
+jlink.additionalmodules=
+# The jlink additional command line parameters
+jlink.additionalparam=
+jlink.launcher=true
+jlink.launcher.name=BinarySearch
+main.class=binarysearch.BinarySearch
+manifest.file=manifest.mf
+meta.inf.dir=${src.dir}/META-INF
+mkdist.disabled=false
+platform.active=default_platform
+run.classpath=\
+ ${javac.classpath}:\
+ ${build.classes.dir}
+# Space-separated list of JVM arguments used when running the project.
+# You may also define separate properties like run-sys-prop.name=value instead of -Dname=value.
+# To set system properties for unit tests define test-sys-prop.name=value:
+run.jvmargs=
+run.modulepath=\
+ ${javac.modulepath}
+run.test.classpath=\
+ ${javac.test.classpath}:\
+ ${build.test.classes.dir}
+run.test.modulepath=\
+ ${javac.test.modulepath}
+source.encoding=UTF-8
+src.dir=src
+test.src.dir=test
diff --git a/Algorithms/Search/BinarySearch/nbproject/project.xml b/Algorithms/Search/BinarySearch/nbproject/project.xml
new file mode 100644
index 0000000..3111c12
--- /dev/null
+++ b/Algorithms/Search/BinarySearch/nbproject/project.xml
@@ -0,0 +1,15 @@
+
+
+ org.netbeans.modules.java.j2seproject
+
+
+ BinarySearch
+
+
+
+
+
+
+
+
+
diff --git a/Algorithms/Search/BinarySearch/src/binarysearch/BinarySearch.java b/Algorithms/Search/BinarySearch/src/binarysearch/BinarySearch.java
new file mode 100644
index 0000000..4ec544c
--- /dev/null
+++ b/Algorithms/Search/BinarySearch/src/binarysearch/BinarySearch.java
@@ -0,0 +1,43 @@
+package binarysearch;
+
+/**
+ *
+ * @author Yash Shah
+ */
+public class BinarySearch
+{
+ /**
+ * Search for a number in the given ASCENDING SORTED array
+ *
+ * @param input Integer array to search in
+ * @param number Integer value to search for
+ * @return int position of the value found
+ */
+ public static int search(int[] input, int number)
+ {
+ int left = 0;
+ int right = input.length;
+ int mid = right/2;
+ int location = -1;
+
+ while(left < right)
+ {
+ if(input[mid] == number)
+ {
+ location = mid;
+ break;
+ }
+ else if(input[mid] < number)
+ {
+ left = mid + 1;
+ mid = left + (right-left)/2;
+ }
+ else
+ {
+ right = mid - 1;
+ mid = left + (right-left)/2;
+ }
+ }
+ return location;
+ }
+}
diff --git a/Algorithms/Search/BinarySearch/test/binarysearch/BinarySearchTest.java b/Algorithms/Search/BinarySearch/test/binarysearch/BinarySearchTest.java
new file mode 100644
index 0000000..6a20b86
--- /dev/null
+++ b/Algorithms/Search/BinarySearch/test/binarysearch/BinarySearchTest.java
@@ -0,0 +1,25 @@
+package binarysearch;
+
+import org.junit.Test;
+import static org.junit.Assert.*;
+
+/**
+ *
+ * @author Yash Shah
+ */
+public class BinarySearchTest
+{
+ /**
+ * Test of search method, of class BinarySearch.
+ */
+ @Test
+ public void testSearch()
+ {
+ System.out.println("search");
+ int[] input = {11, 12, 23, 34, 35, 46, 57, 68, 79, 100, 145, 156};
+ assertEquals(-1, BinarySearch.search(input, 134));
+ assertEquals(9, BinarySearch.search(input, 100));
+ assertEquals(-1, BinarySearch.search(input, 5));
+ }
+
+}
diff --git a/Algorithms/BreadthFirstSearch/README.md b/Algorithms/Search/BreadthFirstSearch/README.md
similarity index 83%
rename from Algorithms/BreadthFirstSearch/README.md
rename to Algorithms/Search/BreadthFirstSearch/README.md
index 712a3eb..4e888fe 100644
--- a/Algorithms/BreadthFirstSearch/README.md
+++ b/Algorithms/Search/BreadthFirstSearch/README.md
@@ -5,7 +5,5 @@
and [Queue](https://github.com/yashshah03/Java/tree/master/DataStructures/Queue) as the base DataStructure._**
## Methods:
- - setGraph(Graph)
- * Set the graph to use the BFS algorithm on
- - search(value)
+ - search(graph, value)
* Breadth First Search for the given value in the graph
\ No newline at end of file
diff --git a/Algorithms/BreadthFirstSearch/build.xml b/Algorithms/Search/BreadthFirstSearch/build.xml
similarity index 100%
rename from Algorithms/BreadthFirstSearch/build.xml
rename to Algorithms/Search/BreadthFirstSearch/build.xml
diff --git a/Algorithms/Dijkstra/manifest.mf b/Algorithms/Search/BreadthFirstSearch/manifest.mf
similarity index 100%
rename from Algorithms/Dijkstra/manifest.mf
rename to Algorithms/Search/BreadthFirstSearch/manifest.mf
diff --git a/Algorithms/BreadthFirstSearch/nbproject/build-impl.xml b/Algorithms/Search/BreadthFirstSearch/nbproject/build-impl.xml
similarity index 100%
rename from Algorithms/BreadthFirstSearch/nbproject/build-impl.xml
rename to Algorithms/Search/BreadthFirstSearch/nbproject/build-impl.xml
diff --git a/Algorithms/BreadthFirstSearch/nbproject/genfiles.properties b/Algorithms/Search/BreadthFirstSearch/nbproject/genfiles.properties
similarity index 100%
rename from Algorithms/BreadthFirstSearch/nbproject/genfiles.properties
rename to Algorithms/Search/BreadthFirstSearch/nbproject/genfiles.properties
diff --git a/Algorithms/BreadthFirstSearch/nbproject/project.properties b/Algorithms/Search/BreadthFirstSearch/nbproject/project.properties
similarity index 97%
rename from Algorithms/BreadthFirstSearch/nbproject/project.properties
rename to Algorithms/Search/BreadthFirstSearch/nbproject/project.properties
index feed3bc..c9b4752 100644
--- a/Algorithms/BreadthFirstSearch/nbproject/project.properties
+++ b/Algorithms/Search/BreadthFirstSearch/nbproject/project.properties
@@ -1,9 +1,10 @@
annotation.processing.enabled=true
annotation.processing.enabled.in.editor=false
-annotation.processing.processor.options=
annotation.processing.processors.list=
annotation.processing.run.all.processors=true
annotation.processing.source.output=${build.generated.sources.dir}/ap-source-output
+application.title=BreadthFirstSearch
+application.vendor=yashs
build.classes.dir=${build.dir}/classes
build.classes.excludes=**/*.java,**/*.form
# This directory is removed when the project is cleaned:
@@ -32,6 +33,7 @@ dist.jar=${dist.dir}/BreadthFirstSearch.jar
dist.javadoc.dir=${dist.dir}/javadoc
dist.jlink.dir=${dist.dir}/jlink
dist.jlink.output=${dist.jlink.dir}/BreadthFirstSearch
+endorsed.classpath=
excludes=
file.reference.CustomException.jar=..\\..\\CustomException\\dist\\CustomException.jar
file.reference.Graph.jar=..\\..\\DataStructures\\Graph\\dist\\Graph.jar
diff --git a/Algorithms/BreadthFirstSearch/nbproject/project.xml b/Algorithms/Search/BreadthFirstSearch/nbproject/project.xml
similarity index 100%
rename from Algorithms/BreadthFirstSearch/nbproject/project.xml
rename to Algorithms/Search/BreadthFirstSearch/nbproject/project.xml
diff --git a/Algorithms/BreadthFirstSearch/src/breadthfirstsearch/BreadthFirstSearch.java b/Algorithms/Search/BreadthFirstSearch/src/breadthfirstsearch/BreadthFirstSearch.java
similarity index 76%
rename from Algorithms/BreadthFirstSearch/src/breadthfirstsearch/BreadthFirstSearch.java
rename to Algorithms/Search/BreadthFirstSearch/src/breadthfirstsearch/BreadthFirstSearch.java
index 98b7813..58f396f 100644
--- a/Algorithms/BreadthFirstSearch/src/breadthfirstsearch/BreadthFirstSearch.java
+++ b/Algorithms/Search/BreadthFirstSearch/src/breadthfirstsearch/BreadthFirstSearch.java
@@ -1,5 +1,6 @@
package breadthfirstsearch;
+import customexception.CustomException;
import graph.Edge;
import graph.Graph;
import java.util.ArrayList;
@@ -12,30 +13,20 @@
*/
public class BreadthFirstSearch
{
-
- private Graph graph = new Graph();
- private HashSet visited = new HashSet<>();
-
- /**
- * Set a Graph
- *
- * @param graph Graph to be used
- */
- public void setGraph(Graph graph)
- {
- this.graph = graph;
- }
-
/**
* Search for a value in the graph
*
+ * @param graph Graph to search the value in
* @param value value to search
* @return True if found, false otherwise
*/
- public boolean search(String value)
+ public static boolean
+ search(Graph graph, String value)
{
+ HashSet visited = new HashSet<>();
+
Queue nodes = new Queue<>();
- String current = this.graph.getNodes().get(0).getValue();
+ String current = graph.getNodes().get(0).getValue();
// Push current node to the stack
nodes.enqueue(current);
// Add current node to visited set
@@ -51,7 +42,7 @@ public boolean search(String value)
try
{
// Get adjecency
- ArrayList adjecency = this.graph.getEdges(current);
+ ArrayList adjecency = graph.getEdges(current);
// Traverse through all adjecency edges
// Put all adjecent nodes in stack, if not visited
for(Edge e: adjecency)
@@ -66,7 +57,7 @@ public boolean search(String value)
}
}
}
- catch(Exception e)
+ catch(CustomException e)
{
System.err.println("[ERROR] " + e.getMessage());
}
diff --git a/Algorithms/BreadthFirstSearch/test/breadthfirstsearch/BreadthFirstSearchTest.java b/Algorithms/Search/BreadthFirstSearch/test/breadthfirstsearch/BreadthFirstSearchTest.java
similarity index 90%
rename from Algorithms/BreadthFirstSearch/test/breadthfirstsearch/BreadthFirstSearchTest.java
rename to Algorithms/Search/BreadthFirstSearch/test/breadthfirstsearch/BreadthFirstSearchTest.java
index c9e0285..dc27e7b 100644
--- a/Algorithms/BreadthFirstSearch/test/breadthfirstsearch/BreadthFirstSearchTest.java
+++ b/Algorithms/Search/BreadthFirstSearch/test/breadthfirstsearch/BreadthFirstSearchTest.java
@@ -23,12 +23,10 @@ public class BreadthFirstSearchTest
public void testSearch()
{
System.out.println("search");
- BreadthFirstSearch instance = new BreadthFirstSearch();
Graph g = createNewGraph();
- instance.setGraph(g);
- assertEquals(true, instance.search("Honolulu"));
- assertEquals(false, instance.search("New York"));
- assertEquals(false, instance.search("Boston"));
+ assertEquals(true, BreadthFirstSearch.search(g, "Honolulu"));
+ assertEquals(false, BreadthFirstSearch.search(g, "New York"));
+ assertEquals(true, BreadthFirstSearch.search(g, "Astana"));
}
private Graph
diff --git a/Algorithms/DepthFirstSearch/README.md b/Algorithms/Search/DepthFirstSearch/README.md
similarity index 83%
rename from Algorithms/DepthFirstSearch/README.md
rename to Algorithms/Search/DepthFirstSearch/README.md
index 827fc94..b990fe8 100644
--- a/Algorithms/DepthFirstSearch/README.md
+++ b/Algorithms/Search/DepthFirstSearch/README.md
@@ -5,8 +5,6 @@
and [Stack](https://github.com/yashshah03/Java/tree/master/DataStructures/Stack) as the base DataStructure._**
## Methods:
- - setGraph(Graph)
- * Set the graph to use the DFS algorithm on
- - search(value)
+ - search(graph, value)
* Depth First Search for the given value in the graph
\ No newline at end of file
diff --git a/Algorithms/DepthFirstSearch/build.xml b/Algorithms/Search/DepthFirstSearch/build.xml
similarity index 100%
rename from Algorithms/DepthFirstSearch/build.xml
rename to Algorithms/Search/DepthFirstSearch/build.xml
diff --git a/Algorithms/Search/DepthFirstSearch/manifest.mf b/Algorithms/Search/DepthFirstSearch/manifest.mf
new file mode 100644
index 0000000..328e8e5
--- /dev/null
+++ b/Algorithms/Search/DepthFirstSearch/manifest.mf
@@ -0,0 +1,3 @@
+Manifest-Version: 1.0
+X-COMMENT: Main-Class will be added automatically by build
+
diff --git a/Algorithms/DepthFirstSearch/nbproject/build-impl.xml b/Algorithms/Search/DepthFirstSearch/nbproject/build-impl.xml
similarity index 100%
rename from Algorithms/DepthFirstSearch/nbproject/build-impl.xml
rename to Algorithms/Search/DepthFirstSearch/nbproject/build-impl.xml
diff --git a/Algorithms/DepthFirstSearch/nbproject/genfiles.properties b/Algorithms/Search/DepthFirstSearch/nbproject/genfiles.properties
similarity index 100%
rename from Algorithms/DepthFirstSearch/nbproject/genfiles.properties
rename to Algorithms/Search/DepthFirstSearch/nbproject/genfiles.properties
diff --git a/Algorithms/DepthFirstSearch/nbproject/project.properties b/Algorithms/Search/DepthFirstSearch/nbproject/project.properties
similarity index 93%
rename from Algorithms/DepthFirstSearch/nbproject/project.properties
rename to Algorithms/Search/DepthFirstSearch/nbproject/project.properties
index 9943a02..4f50981 100644
--- a/Algorithms/DepthFirstSearch/nbproject/project.properties
+++ b/Algorithms/Search/DepthFirstSearch/nbproject/project.properties
@@ -1,9 +1,10 @@
annotation.processing.enabled=true
annotation.processing.enabled.in.editor=false
-annotation.processing.processor.options=
annotation.processing.processors.list=
annotation.processing.run.all.processors=true
annotation.processing.source.output=${build.generated.sources.dir}/ap-source-output
+application.title=DepthFirstSearch
+application.vendor=yashs
build.classes.dir=${build.dir}/classes
build.classes.excludes=**/*.java,**/*.form
# This directory is removed when the project is cleaned:
@@ -32,9 +33,11 @@ dist.jar=${dist.dir}/DepthFirstSearch.jar
dist.javadoc.dir=${dist.dir}/javadoc
dist.jlink.dir=${dist.dir}/jlink
dist.jlink.output=${dist.jlink.dir}/DepthFirstSearch
+endorsed.classpath=
excludes=
file.reference.CustomException.jar=..\\..\\CustomException\\dist\\CustomException.jar
file.reference.Graph.jar=..\\..\\DataStructures\\Graph\\dist\\Graph.jar
+file.reference.Graph.jar-1=C:\\Users\\yashs\\Documents\\Projects\\Java\\DataStructures\\Graph\\dist\\Graph.jar
file.reference.hamcrest-core-1.3.jar=C:\\Users\\yashs\\Documents\\netbeans\\platform\\modules\\ext\\hamcrest-core-1.3.jar
file.reference.junit-4.12.jar=C:\\Users\\yashs\\Documents\\netbeans\\platform\\modules\\ext\\junit-4.12.jar
file.reference.LinkedList.jar=..\\..\\DataStructures\\LinkedList\\dist\\LinkedList.jar
@@ -47,7 +50,8 @@ javac.classpath=\
${file.reference.Graph.jar}:\
${file.reference.Stack.jar}:\
${file.reference.CustomException.jar}:\
- ${file.reference.LinkedList.jar}
+ ${file.reference.LinkedList.jar}:\
+ ${file.reference.Graph.jar-1}
# Space-separated list of extra javac options
javac.compilerargs=
javac.deprecation=false
diff --git a/Algorithms/DepthFirstSearch/nbproject/project.xml b/Algorithms/Search/DepthFirstSearch/nbproject/project.xml
similarity index 100%
rename from Algorithms/DepthFirstSearch/nbproject/project.xml
rename to Algorithms/Search/DepthFirstSearch/nbproject/project.xml
diff --git a/Algorithms/DepthFirstSearch/src/depthfirstsearch/DepthFirstSearch.java b/Algorithms/Search/DepthFirstSearch/src/depthfirstsearch/DepthFirstSearch.java
similarity index 76%
rename from Algorithms/DepthFirstSearch/src/depthfirstsearch/DepthFirstSearch.java
rename to Algorithms/Search/DepthFirstSearch/src/depthfirstsearch/DepthFirstSearch.java
index 882f255..a1bfad6 100644
--- a/Algorithms/DepthFirstSearch/src/depthfirstsearch/DepthFirstSearch.java
+++ b/Algorithms/Search/DepthFirstSearch/src/depthfirstsearch/DepthFirstSearch.java
@@ -1,5 +1,6 @@
package depthfirstsearch;
+import customexception.CustomException;
import graph.Edge;
import graph.Graph;
import java.util.ArrayList;
@@ -12,30 +13,20 @@
*/
public class DepthFirstSearch
{
- private Graph graph = new Graph();
- private HashSet visited = new HashSet<>();
- /**
- * Set a Graph
- *
- * @param graph Graph to be used
- */
- public void setGraph(Graph graph)
- {
- this.graph = graph;
- }
-
-
-
/**
* Search for a value in the graph
*
+ * @param graph Graph to search the value in
* @param value value to search
* @return True if found, false otherwise
*/
- public boolean search(String value)
+ public static boolean
+ search(Graph graph, String value)
{
+ HashSet visited = new HashSet<>();
+
Stack nodes = new Stack<>();
- String current = this.graph.getNodes().get(0).getValue();
+ String current = graph.getNodes().get(0).getValue();
// Push current node to the stack
nodes.push(current);
// Add current node to visited set
@@ -51,7 +42,7 @@ public boolean search(String value)
try
{
// Get adjecency
- ArrayList adjecency = this.graph.getEdges(current);
+ ArrayList adjecency = graph.getEdges(current);
// Traverse through all adjecency edges
// Put all adjecent nodes in stack, if not visited
for(Edge e: adjecency)
@@ -66,7 +57,7 @@ public boolean search(String value)
}
}
}
- catch(Exception e)
+ catch(CustomException e)
{
System.err.println("[ERROR] " + e.getMessage());
}
diff --git a/Algorithms/DepthFirstSearch/test/depthfirstsearch/DepthFirstSearchTest.java b/Algorithms/Search/DepthFirstSearch/test/depthfirstsearch/DepthFirstSearchTest.java
similarity index 90%
rename from Algorithms/DepthFirstSearch/test/depthfirstsearch/DepthFirstSearchTest.java
rename to Algorithms/Search/DepthFirstSearch/test/depthfirstsearch/DepthFirstSearchTest.java
index b32a61a..8d316ae 100644
--- a/Algorithms/DepthFirstSearch/test/depthfirstsearch/DepthFirstSearchTest.java
+++ b/Algorithms/Search/DepthFirstSearch/test/depthfirstsearch/DepthFirstSearchTest.java
@@ -22,12 +22,10 @@ public class DepthFirstSearchTest
@Test
public void testSearch() {
System.out.println("search");
- DepthFirstSearch instance = new DepthFirstSearch();
Graph g = createNewGraph();
- instance.setGraph(g);
- assertEquals(true, instance.search("Honolulu"));
- assertEquals(false, instance.search("New York"));
- assertEquals(false, instance.search("Boston"));
+ assertEquals(true, DepthFirstSearch.search(g, "Honolulu"));
+ assertEquals(false, DepthFirstSearch.search(g, "New York"));
+ assertEquals(true, DepthFirstSearch.search(g, "Astana"));
}
private Graph
diff --git a/Algorithms/Search/README.md b/Algorithms/Search/README.md
new file mode 100644
index 0000000..c2ef6a9
--- /dev/null
+++ b/Algorithms/Search/README.md
@@ -0,0 +1,6 @@
+**This repository contains different types of searching algorithms written in Java programming language**
+
+## List of projects ##
+1. [Binary Search](https://github.com/yashshah03/Java/tree/master/Algorithms/Search/BinarySearch)
+2. [Breadth First Search](https://github.com/yashshah03/Java/tree/master/Algorithms/Search/BreadthFirstSearch)
+3. [Depth First Search](https://github.com/yashshah03/Java/tree/master/Algorithms/Search/DepthFirstSearch)
diff --git a/Algorithms/Sort/CountingSort/README.md b/Algorithms/Sort/CountingSort/README.md
new file mode 100644
index 0000000..46a93d0
--- /dev/null
+++ b/Algorithms/Sort/CountingSort/README.md
@@ -0,0 +1,7 @@
+## This project contains sample implementation of Counting Sort on a char array in java
+ **The project is developed using Apache Netbeans IDE 10.0, Java 8, Windows 10**
+
+## Methods:
+ - sort(input)
+ * Sort given input array in Ascending format
+
\ No newline at end of file
diff --git a/Algorithms/Sort/CountingSort/build.xml b/Algorithms/Sort/CountingSort/build.xml
new file mode 100644
index 0000000..8b2c74d
--- /dev/null
+++ b/Algorithms/Sort/CountingSort/build.xml
@@ -0,0 +1,73 @@
+
+
+
+
+
+
+
+
+
+
+ Builds, tests, and runs the project CountingSort.
+
+
+
diff --git a/Algorithms/Sort/CountingSort/manifest.mf b/Algorithms/Sort/CountingSort/manifest.mf
new file mode 100644
index 0000000..328e8e5
--- /dev/null
+++ b/Algorithms/Sort/CountingSort/manifest.mf
@@ -0,0 +1,3 @@
+Manifest-Version: 1.0
+X-COMMENT: Main-Class will be added automatically by build
+
diff --git a/Algorithms/Sort/CountingSort/nbproject/build-impl.xml b/Algorithms/Sort/CountingSort/nbproject/build-impl.xml
new file mode 100644
index 0000000..e6f0461
--- /dev/null
+++ b/Algorithms/Sort/CountingSort/nbproject/build-impl.xml
@@ -0,0 +1,1768 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Must set src.dir
+ Must set test.src.dir
+ Must set build.dir
+ Must set dist.dir
+ Must set build.classes.dir
+ Must set dist.javadoc.dir
+ Must set build.test.classes.dir
+ Must set build.test.results.dir
+ Must set build.classes.excludes
+ Must set dist.jar
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Must set javac.includes
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ No tests executed.
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Must set JVM to use for profiling in profiler.info.jvm
+ Must set profiler agent JVM arguments in profiler.info.jvmargs.agent
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Must select some files in the IDE or set javac.includes
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ To run this application from the command line without Ant, try:
+
+ java -jar "${dist.jar.resolved}"
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Must select one file in the IDE or set run.class
+
+
+
+ Must select one file in the IDE or set run.class
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Must select one file in the IDE or set debug.class
+
+
+
+
+ Must select one file in the IDE or set debug.class
+
+
+
+
+ Must set fix.includes
+
+
+
+
+
+
+
+
+
+ This target only works when run from inside the NetBeans IDE.
+
+
+
+
+
+
+
+
+ Must select one file in the IDE or set profile.class
+ This target only works when run from inside the NetBeans IDE.
+
+
+
+
+
+
+
+
+ This target only works when run from inside the NetBeans IDE.
+
+
+
+
+
+
+
+
+
+
+
+
+ This target only works when run from inside the NetBeans IDE.
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Must select one file in the IDE or set run.class
+
+
+
+
+
+ Must select some files in the IDE or set test.includes
+
+
+
+
+ Must select one file in the IDE or set run.class
+
+
+
+
+ Must select one file in the IDE or set applet.url
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Must select some files in the IDE or set javac.includes
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Some tests failed; see details above.
+
+
+
+
+
+
+
+
+ Must select some files in the IDE or set test.includes
+
+
+
+ Some tests failed; see details above.
+
+
+
+ Must select some files in the IDE or set test.class
+ Must select some method in the IDE or set test.method
+
+
+
+ Some tests failed; see details above.
+
+
+
+
+ Must select one file in the IDE or set test.class
+
+
+
+ Must select one file in the IDE or set test.class
+ Must select some method in the IDE or set test.method
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Must select one file in the IDE or set applet.url
+
+
+
+
+
+
+
+
+ Must select one file in the IDE or set applet.url
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/Algorithms/Sort/CountingSort/nbproject/genfiles.properties b/Algorithms/Sort/CountingSort/nbproject/genfiles.properties
new file mode 100644
index 0000000..83df776
--- /dev/null
+++ b/Algorithms/Sort/CountingSort/nbproject/genfiles.properties
@@ -0,0 +1,8 @@
+build.xml.data.CRC32=15efb29d
+build.xml.script.CRC32=ab62d428
+build.xml.stylesheet.CRC32=f85dc8f2@1.90.1.48
+# This file is used by a NetBeans-based IDE to track changes in generated files such as build-impl.xml.
+# Do not edit this file. You may delete it but then the IDE will never regenerate such files for you.
+nbproject/build-impl.xml.data.CRC32=15efb29d
+nbproject/build-impl.xml.script.CRC32=dd23c14c
+nbproject/build-impl.xml.stylesheet.CRC32=3a2fa800@1.90.1.48
diff --git a/Algorithms/Sort/CountingSort/nbproject/project.properties b/Algorithms/Sort/CountingSort/nbproject/project.properties
new file mode 100644
index 0000000..c9465ca
--- /dev/null
+++ b/Algorithms/Sort/CountingSort/nbproject/project.properties
@@ -0,0 +1,99 @@
+annotation.processing.enabled=true
+annotation.processing.enabled.in.editor=false
+annotation.processing.processor.options=
+annotation.processing.processors.list=
+annotation.processing.run.all.processors=true
+annotation.processing.source.output=${build.generated.sources.dir}/ap-source-output
+build.classes.dir=${build.dir}/classes
+build.classes.excludes=**/*.java,**/*.form
+# This directory is removed when the project is cleaned:
+build.dir=build
+build.generated.dir=${build.dir}/generated
+build.generated.sources.dir=${build.dir}/generated-sources
+# Only compile against the classpath explicitly listed here:
+build.sysclasspath=ignore
+build.test.classes.dir=${build.dir}/test/classes
+build.test.results.dir=${build.dir}/test/results
+# Uncomment to specify the preferred debugger connection transport:
+#debug.transport=dt_socket
+debug.classpath=\
+ ${run.classpath}
+debug.modulepath=\
+ ${run.modulepath}
+debug.test.classpath=\
+ ${run.test.classpath}
+debug.test.modulepath=\
+ ${run.test.modulepath}
+# Files in build.classes.dir which should be excluded from distribution jar
+dist.archive.excludes=
+# This directory is removed when the project is cleaned:
+dist.dir=dist
+dist.jar=${dist.dir}/CountingSort.jar
+dist.javadoc.dir=${dist.dir}/javadoc
+dist.jlink.dir=${dist.dir}/jlink
+dist.jlink.output=${dist.jlink.dir}/CountingSort
+excludes=
+file.reference.hamcrest-core-1.3.jar=C:\\Users\\yashs\\Documents\\netbeans\\platform\\modules\\ext\\hamcrest-core-1.3.jar
+file.reference.junit-4.12.jar=C:\\Users\\yashs\\Documents\\netbeans\\platform\\modules\\ext\\junit-4.12.jar
+includes=**
+jar.compress=false
+javac.classpath=\
+ ${file.reference.hamcrest-core-1.3.jar}:\
+ ${file.reference.junit-4.12.jar}
+# Space-separated list of extra javac options
+javac.compilerargs=
+javac.deprecation=false
+javac.external.vm=true
+javac.modulepath=
+javac.processormodulepath=
+javac.processorpath=\
+ ${javac.classpath}
+javac.source=1.8
+javac.target=1.8
+javac.test.classpath=\
+ ${javac.classpath}:\
+ ${build.classes.dir}
+javac.test.modulepath=\
+ ${javac.modulepath}
+javac.test.processorpath=\
+ ${javac.test.classpath}
+javadoc.additionalparam=
+javadoc.author=false
+javadoc.encoding=${source.encoding}
+javadoc.html5=false
+javadoc.noindex=false
+javadoc.nonavbar=false
+javadoc.notree=false
+javadoc.private=false
+javadoc.splitindex=true
+javadoc.use=true
+javadoc.version=false
+javadoc.windowtitle=
+# The jlink additional root modules to resolve
+jlink.additionalmodules=
+# The jlink additional command line parameters
+jlink.additionalparam=
+jlink.launcher=true
+jlink.launcher.name=CountingSort
+main.class=countingsort.CountingSort
+manifest.file=manifest.mf
+meta.inf.dir=${src.dir}/META-INF
+mkdist.disabled=false
+platform.active=default_platform
+run.classpath=\
+ ${javac.classpath}:\
+ ${build.classes.dir}
+# Space-separated list of JVM arguments used when running the project.
+# You may also define separate properties like run-sys-prop.name=value instead of -Dname=value.
+# To set system properties for unit tests define test-sys-prop.name=value:
+run.jvmargs=
+run.modulepath=\
+ ${javac.modulepath}
+run.test.classpath=\
+ ${javac.test.classpath}:\
+ ${build.test.classes.dir}
+run.test.modulepath=\
+ ${javac.test.modulepath}
+source.encoding=UTF-8
+src.dir=src
+test.src.dir=test
diff --git a/Algorithms/Sort/CountingSort/nbproject/project.xml b/Algorithms/Sort/CountingSort/nbproject/project.xml
new file mode 100644
index 0000000..b522002
--- /dev/null
+++ b/Algorithms/Sort/CountingSort/nbproject/project.xml
@@ -0,0 +1,15 @@
+
+
+ org.netbeans.modules.java.j2seproject
+
+
+ CountingSort
+
+
+
+
+
+
+
+
+
diff --git a/Algorithms/Sort/CountingSort/src/countingsort/CountingSort.java b/Algorithms/Sort/CountingSort/src/countingsort/CountingSort.java
new file mode 100644
index 0000000..1b278ca
--- /dev/null
+++ b/Algorithms/Sort/CountingSort/src/countingsort/CountingSort.java
@@ -0,0 +1,64 @@
+package countingsort;
+/**
+ *
+ * @author Yash Shah
+ */
+public class CountingSort
+{
+ /**
+ * Implements counting sort for a char array
+ *
+ * @param input
+ * @return sorted array
+ */
+ public static char[]
+ sort(char[] input)
+ {
+ // output array
+ char[] output = new char[input.length];
+ // Auxilary array
+ int[] aux = new int[256];
+
+ // Store the occurences of chars
+ for(int i=0; i=0; i--)
+ {
+ char temp = input[i];
+ int pos = getCharToInt(temp);
+ // Decrement the count at POS by 1 in AUX array
+ aux[pos]--;
+ // Put the element fron input at i in output at aux[pos]
+ output[aux[pos]] = temp;
+ }
+ return output;
+ }
+
+ private static int
+ getCharToInt(char val)
+ {
+ int pos;
+ // If letter is uppercase
+ if(Character.isUpperCase(val))
+ pos = val - 'A';
+ else
+ pos = val - 'a';
+
+ return pos;
+ }
+}
diff --git a/Algorithms/Sort/CountingSort/test/countingsort/CountingSortTest.java b/Algorithms/Sort/CountingSort/test/countingsort/CountingSortTest.java
new file mode 100644
index 0000000..5f5587b
--- /dev/null
+++ b/Algorithms/Sort/CountingSort/test/countingsort/CountingSortTest.java
@@ -0,0 +1,28 @@
+package countingsort;
+
+import org.junit.Test;
+import static org.junit.Assert.*;
+
+/**
+ *
+ * @author Yash Shah
+ */
+public class CountingSortTest
+{
+ /**
+ * Test of sort method, of class CountingSort.
+ */
+ @Test
+ public void testSort()
+ {
+ System.out.println("sort");
+ char[] input = {'a', 'b', 'a', 'c', 'e', 'A', 'B', 'h', 'I', 'j', 'k'};
+ char[] expResult = {'a', 'a', 'A', 'b', 'B', 'c', 'e', 'h', 'I', 'j', 'k'};
+ char[] result = CountingSort.sort(input);
+ assertArrayEquals(expResult, result);
+ char[] input2 = {'a', 'b', 'A', 'c', 'e', 'C', 'B', 'h', 'I', 'i', 'k'};
+ char[] expResult2 = {'a', 'A', 'b', 'B', 'c', 'C', 'e', 'h', 'I', 'i', 'k'};
+ char[] result2 = CountingSort.sort(input2);
+ assertArrayEquals(expResult2, result2);
+ }
+}
diff --git a/Algorithms/Sort/README.md b/Algorithms/Sort/README.md
new file mode 100644
index 0000000..72656ad
--- /dev/null
+++ b/Algorithms/Sort/README.md
@@ -0,0 +1,4 @@
+**This repository contains different types of sorting algorithms written in Java programming language**
+
+## List of projects ##
+1. [Counting Sort](https://github.com/yashshah03/Java/tree/master/Algorithms/Sort/CountingSort)
diff --git a/Algorithms/Traversal/BreadthFirstTraverse/README.md b/Algorithms/Traversal/BreadthFirstTraverse/README.md
new file mode 100644
index 0000000..a8ba9e1
--- /dev/null
+++ b/Algorithms/Traversal/BreadthFirstTraverse/README.md
@@ -0,0 +1,9 @@
+## This project contains sample implementation of Breadth First Traversal in java
+ **The project is developed using Apache Netbeans IDE 10.0, Java 8, Windows 10**
+
+**_This project uses my implementation of [Graph](https://github.com/yashshah03/Java/tree/master/DataStructures/Graph)
+and [Queue](https://github.com/yashshah03/Java/tree/master/DataStructures/Queue) as the base DataStructure._**
+
+## Methods:
+ - traverse(graph)
+ * Breadth First traverse on the given graph
\ No newline at end of file
diff --git a/Algorithms/Traversal/BreadthFirstTraverse/build.xml b/Algorithms/Traversal/BreadthFirstTraverse/build.xml
new file mode 100644
index 0000000..2f9f987
--- /dev/null
+++ b/Algorithms/Traversal/BreadthFirstTraverse/build.xml
@@ -0,0 +1,73 @@
+
+
+
+
+
+
+
+
+
+
+ Builds, tests, and runs the project BreadthFirstTraverse.
+
+
+
diff --git a/Algorithms/Traversal/BreadthFirstTraverse/manifest.mf b/Algorithms/Traversal/BreadthFirstTraverse/manifest.mf
new file mode 100644
index 0000000..328e8e5
--- /dev/null
+++ b/Algorithms/Traversal/BreadthFirstTraverse/manifest.mf
@@ -0,0 +1,3 @@
+Manifest-Version: 1.0
+X-COMMENT: Main-Class will be added automatically by build
+
diff --git a/Algorithms/Traversal/BreadthFirstTraverse/nbproject/build-impl.xml b/Algorithms/Traversal/BreadthFirstTraverse/nbproject/build-impl.xml
new file mode 100644
index 0000000..75b8f00
--- /dev/null
+++ b/Algorithms/Traversal/BreadthFirstTraverse/nbproject/build-impl.xml
@@ -0,0 +1,1768 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Must set src.dir
+ Must set test.src.dir
+ Must set build.dir
+ Must set dist.dir
+ Must set build.classes.dir
+ Must set dist.javadoc.dir
+ Must set build.test.classes.dir
+ Must set build.test.results.dir
+ Must set build.classes.excludes
+ Must set dist.jar
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Must set javac.includes
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ No tests executed.
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Must set JVM to use for profiling in profiler.info.jvm
+ Must set profiler agent JVM arguments in profiler.info.jvmargs.agent
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Must select some files in the IDE or set javac.includes
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ To run this application from the command line without Ant, try:
+
+ java -jar "${dist.jar.resolved}"
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Must select one file in the IDE or set run.class
+
+
+
+ Must select one file in the IDE or set run.class
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Must select one file in the IDE or set debug.class
+
+
+
+
+ Must select one file in the IDE or set debug.class
+
+
+
+
+ Must set fix.includes
+
+
+
+
+
+
+
+
+
+ This target only works when run from inside the NetBeans IDE.
+
+
+
+
+
+
+
+
+ Must select one file in the IDE or set profile.class
+ This target only works when run from inside the NetBeans IDE.
+
+
+
+
+
+
+
+
+ This target only works when run from inside the NetBeans IDE.
+
+
+
+
+
+
+
+
+
+
+
+
+ This target only works when run from inside the NetBeans IDE.
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Must select one file in the IDE or set run.class
+
+
+
+
+
+ Must select some files in the IDE or set test.includes
+
+
+
+
+ Must select one file in the IDE or set run.class
+
+
+
+
+ Must select one file in the IDE or set applet.url
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Must select some files in the IDE or set javac.includes
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Some tests failed; see details above.
+
+
+
+
+
+
+
+
+ Must select some files in the IDE or set test.includes
+
+
+
+ Some tests failed; see details above.
+
+
+
+ Must select some files in the IDE or set test.class
+ Must select some method in the IDE or set test.method
+
+
+
+ Some tests failed; see details above.
+
+
+
+
+ Must select one file in the IDE or set test.class
+
+
+
+ Must select one file in the IDE or set test.class
+ Must select some method in the IDE or set test.method
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Must select one file in the IDE or set applet.url
+
+
+
+
+
+
+
+
+ Must select one file in the IDE or set applet.url
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/Algorithms/Traversal/BreadthFirstTraverse/nbproject/genfiles.properties b/Algorithms/Traversal/BreadthFirstTraverse/nbproject/genfiles.properties
new file mode 100644
index 0000000..12a7946
--- /dev/null
+++ b/Algorithms/Traversal/BreadthFirstTraverse/nbproject/genfiles.properties
@@ -0,0 +1,8 @@
+build.xml.data.CRC32=abead4aa
+build.xml.script.CRC32=0e7519ce
+build.xml.stylesheet.CRC32=f85dc8f2@1.90.1.48
+# This file is used by a NetBeans-based IDE to track changes in generated files such as build-impl.xml.
+# Do not edit this file. You may delete it but then the IDE will never regenerate such files for you.
+nbproject/build-impl.xml.data.CRC32=abead4aa
+nbproject/build-impl.xml.script.CRC32=655c37d5
+nbproject/build-impl.xml.stylesheet.CRC32=3a2fa800@1.90.1.48
diff --git a/Algorithms/Traversal/BreadthFirstTraverse/nbproject/project.properties b/Algorithms/Traversal/BreadthFirstTraverse/nbproject/project.properties
new file mode 100644
index 0000000..2a5f332
--- /dev/null
+++ b/Algorithms/Traversal/BreadthFirstTraverse/nbproject/project.properties
@@ -0,0 +1,110 @@
+annotation.processing.enabled=true
+annotation.processing.enabled.in.editor=false
+annotation.processing.processors.list=
+annotation.processing.run.all.processors=true
+annotation.processing.source.output=${build.generated.sources.dir}/ap-source-output
+application.title=BreadthFirstTraverse
+application.vendor=yashs
+build.classes.dir=${build.dir}/classes
+build.classes.excludes=**/*.java,**/*.form
+# This directory is removed when the project is cleaned:
+build.dir=build
+build.generated.dir=${build.dir}/generated
+build.generated.sources.dir=${build.dir}/generated-sources
+# Only compile against the classpath explicitly listed here:
+build.sysclasspath=ignore
+build.test.classes.dir=${build.dir}/test/classes
+build.test.results.dir=${build.dir}/test/results
+# Uncomment to specify the preferred debugger connection transport:
+#debug.transport=dt_socket
+debug.classpath=\
+ ${run.classpath}
+debug.modulepath=\
+ ${run.modulepath}
+debug.test.classpath=\
+ ${run.test.classpath}
+debug.test.modulepath=\
+ ${run.test.modulepath}
+# Files in build.classes.dir which should be excluded from distribution jar
+dist.archive.excludes=
+# This directory is removed when the project is cleaned:
+dist.dir=dist
+dist.jar=${dist.dir}/BreadthFirstTraverse.jar
+dist.javadoc.dir=${dist.dir}/javadoc
+dist.jlink.dir=${dist.dir}/jlink
+dist.jlink.output=${dist.jlink.dir}/BreadthFirstTraverse
+endorsed.classpath=
+excludes=
+file.reference.CustomException.jar=C:\\Users\\yashs\\Documents\\Projects\\Java\\CustomException\\dist\\CustomException.jar
+file.reference.Graph.jar=C:\\Users\\yashs\\Documents\\Projects\\Java\\DataStructures\\Graph\\dist\\Graph.jar
+file.reference.hamcrest-core-1.3.jar=C:\\Users\\yashs\\Documents\\netbeans\\platform\\modules\\ext\\hamcrest-core-1.3.jar
+file.reference.junit-4.12.jar=C:\\Users\\yashs\\Documents\\netbeans\\platform\\modules\\ext\\junit-4.12.jar
+file.reference.LinkedList.jar=..\\..\\..\\DataStructures\\LinkedList\\dist\\LinkedList.jar
+file.reference.Queue.jar=C:\\Users\\yashs\\Documents\\Projects\\Java\\DataStructures\\Queue\\dist\\Queue.jar
+includes=**
+jar.compress=false
+javac.classpath=\
+ ${file.reference.CustomException.jar}:\
+ ${file.reference.Graph.jar}:\
+ ${file.reference.Queue.jar}:\
+ ${file.reference.hamcrest-core-1.3.jar}:\
+ ${file.reference.junit-4.12.jar}:\
+ ${file.reference.LinkedList.jar}
+# Space-separated list of extra javac options
+javac.compilerargs=
+javac.deprecation=false
+javac.external.vm=true
+javac.modulepath=
+javac.processormodulepath=
+javac.processorpath=\
+ ${javac.classpath}
+javac.source=1.8
+javac.target=1.8
+javac.test.classpath=\
+ ${javac.classpath}:\
+ ${build.classes.dir}:\
+ ${libs.junit_5.classpath}
+javac.test.modulepath=\
+ ${javac.modulepath}
+javac.test.processorpath=\
+ ${javac.test.classpath}
+javadoc.additionalparam=
+javadoc.author=false
+javadoc.encoding=${source.encoding}
+javadoc.html5=false
+javadoc.noindex=false
+javadoc.nonavbar=false
+javadoc.notree=false
+javadoc.private=false
+javadoc.splitindex=true
+javadoc.use=true
+javadoc.version=false
+javadoc.windowtitle=
+# The jlink additional root modules to resolve
+jlink.additionalmodules=
+# The jlink additional command line parameters
+jlink.additionalparam=
+jlink.launcher=true
+jlink.launcher.name=BreadthFirstTraverse
+main.class=breadthfirsttraverse.BreadthFirstTraverse
+manifest.file=manifest.mf
+meta.inf.dir=${src.dir}/META-INF
+mkdist.disabled=false
+platform.active=default_platform
+run.classpath=\
+ ${javac.classpath}:\
+ ${build.classes.dir}
+# Space-separated list of JVM arguments used when running the project.
+# You may also define separate properties like run-sys-prop.name=value instead of -Dname=value.
+# To set system properties for unit tests define test-sys-prop.name=value:
+run.jvmargs=
+run.modulepath=\
+ ${javac.modulepath}
+run.test.classpath=\
+ ${javac.test.classpath}:\
+ ${build.test.classes.dir}
+run.test.modulepath=\
+ ${javac.test.modulepath}
+source.encoding=UTF-8
+src.dir=src
+test.src.dir=test
diff --git a/Algorithms/Traversal/BreadthFirstTraverse/nbproject/project.xml b/Algorithms/Traversal/BreadthFirstTraverse/nbproject/project.xml
new file mode 100644
index 0000000..a5ec770
--- /dev/null
+++ b/Algorithms/Traversal/BreadthFirstTraverse/nbproject/project.xml
@@ -0,0 +1,15 @@
+
+
+ org.netbeans.modules.java.j2seproject
+
+
+ BreadthFirstTraverse
+
+
+
+
+
+
+
+
+
diff --git a/Algorithms/Traversal/BreadthFirstTraverse/src/breadthfirsttraverse/BreadthFirstTraverse.java b/Algorithms/Traversal/BreadthFirstTraverse/src/breadthfirsttraverse/BreadthFirstTraverse.java
new file mode 100644
index 0000000..8e10c3a
--- /dev/null
+++ b/Algorithms/Traversal/BreadthFirstTraverse/src/breadthfirsttraverse/BreadthFirstTraverse.java
@@ -0,0 +1,60 @@
+package breadthfirsttraverse;
+
+import customexception.CustomException;
+import graph.Edge;
+import graph.Graph;
+import java.util.ArrayList;
+import java.util.HashSet;
+import queue.Queue;
+
+/**
+ *
+ * @author Yash Shah
+ */
+public class BreadthFirstTraverse
+{
+ /**
+ * Traverse the graph Breadth First
+ *
+ * @param graph The graph to traverse
+ */
+ public static void
+ traverse(Graph graph)
+ {
+ HashSet visited = new HashSet<>();
+
+ Queue nodes = new Queue<>();
+ String current = graph.getNodes().get(0).getValue();
+ // Push current node to the stack
+ nodes.enqueue(current);
+ // Add current node to visited set
+ visited.add(current);
+ System.out.println("CURRENT: " + current);
+
+ while(!nodes.isEmpty())
+ {
+ current = nodes.dequeue();
+ System.out.println(current);
+ try
+ {
+ // Get adjecency
+ ArrayList adjecency = graph.getEdges(current);
+ // Traverse through all adjecency edges
+ // Put all adjecent nodes in stack, if not visited
+ for(Edge e: adjecency)
+ {
+ String adjecent = e.getDestination().toString();
+ if(!visited.contains(adjecent))
+ {
+ nodes.enqueue(adjecent);
+ visited.add(adjecent);
+ }
+ }
+ }
+ catch(CustomException e)
+ {
+ System.err.println("[ERROR] " + e.getMessage());
+ }
+ }
+ }
+}
diff --git a/Algorithms/Traversal/BreadthFirstTraverse/test/breadthfirsttraverse/BreadthFirstTraverseTest.java b/Algorithms/Traversal/BreadthFirstTraverse/test/breadthfirsttraverse/BreadthFirstTraverseTest.java
new file mode 100644
index 0000000..04a8fdf
--- /dev/null
+++ b/Algorithms/Traversal/BreadthFirstTraverse/test/breadthfirsttraverse/BreadthFirstTraverseTest.java
@@ -0,0 +1,63 @@
+/*
+ * To change this license header, choose License Headers in Project Properties.
+ * To change this template file, choose Tools | Templates
+ * and open the template in the editor.
+ */
+package breadthfirsttraverse;
+
+import customexception.CustomException;
+import graph.Graph;
+import org.junit.Test;
+
+/**
+ *
+ * @author Yash Shah
+ */
+public class BreadthFirstTraverseTest
+{
+ /**
+ * Test of traverse method, of class BreadthFirstTraverse.
+ */
+ @Test
+ public void testTraverse() {
+ BreadthFirstTraverse.traverse(createNewGraph());
+ }
+
+ private Graph
+ createNewGraph()
+ {
+ Graph graph = new Graph();
+ try
+ {
+ graph.addUnidirectionalEdge("Astana", "Delhi", 4126);
+ graph.addUnidirectionalEdge("Astana", "Beijing", 4175);
+ graph.addUnidirectionalEdge("Astana", "Moscow", 2150);
+ graph.addUnidirectionalEdge("Delhi", "Singapor", 4140);
+ graph.addUnidirectionalEdge("Beijing", "Singapor", 4742);
+ graph.addUnidirectionalEdge("Beijing", "Tokyo", 2098);
+ graph.addUnidirectionalEdge("Moscow", "London", 2498);
+ graph.addUnidirectionalEdge("Moscow", "Algiers", 3336);
+ graph.addUnidirectionalEdge("Moscow", "Barcelona", 3006);
+ graph.addUnidirectionalEdge("Singapor", "Brisbane", 6152);
+ graph.addUnidirectionalEdge("Tokyo", "Honolulu", 6195);
+ graph.addUnidirectionalEdge("Tokyo", "Anchorage", 5555);
+ graph.addUnidirectionalEdge("London", "Boston", 5264);
+ graph.addUnidirectionalEdge("Algiers", "San Juan", 7015);
+ graph.addUnidirectionalEdge("Barcelona", "Boston", 5861);
+ graph.addUnidirectionalEdge("Brisbane", "Honolulu", 7566);
+ graph.addUnidirectionalEdge("Honolulu", "San Fransicso", 3851);
+ graph.addUnidirectionalEdge("Anchorage", "Vancouver", 2129);
+ graph.addUnidirectionalEdge("Boston", "Vancouver", 4022);
+ graph.addUnidirectionalEdge("San Juan", "Houston", 3178);
+ graph.addUnidirectionalEdge("San Juan", "Helena", 5194);
+ graph.addUnidirectionalEdge("San Fransicso", "Vancouver", 1276);
+ graph.addUnidirectionalEdge("Houston", "Vancouver", 3184);
+ graph.addUnidirectionalEdge("Helena", "Vancouver", 880);
+ }
+ catch (CustomException ex)
+ {
+ System.err.println(ex.getMessage());
+ }
+ return graph;
+ }
+}
diff --git a/Algorithms/Traversal/DepthFirstTraverse/README.md b/Algorithms/Traversal/DepthFirstTraverse/README.md
new file mode 100644
index 0000000..4c21d7a
--- /dev/null
+++ b/Algorithms/Traversal/DepthFirstTraverse/README.md
@@ -0,0 +1,9 @@
+## This project contains sample implementation of Depth First Traversal in java
+ **The project is developed using Apache Netbeans IDE 10.0, Java 8, Windows 10**
+
+**_This project uses my implementation of [Graph](https://github.com/yashshah03/Java/tree/master/DataStructures/Graph)
+and [Stack](https://github.com/yashshah03/Java/tree/master/DataStructures/Stack) as the base DataStructure._**
+
+## Methods:
+ - traverse(graph)
+ * Depth First traverse on the given graph
\ No newline at end of file
diff --git a/Algorithms/Traversal/DepthFirstTraverse/build.xml b/Algorithms/Traversal/DepthFirstTraverse/build.xml
new file mode 100644
index 0000000..4a9ff2f
--- /dev/null
+++ b/Algorithms/Traversal/DepthFirstTraverse/build.xml
@@ -0,0 +1,73 @@
+
+
+
+
+
+
+
+
+
+
+ Builds, tests, and runs the project DepthFirstTraverse.
+
+
+
diff --git a/Algorithms/Traversal/DepthFirstTraverse/manifest.mf b/Algorithms/Traversal/DepthFirstTraverse/manifest.mf
new file mode 100644
index 0000000..328e8e5
--- /dev/null
+++ b/Algorithms/Traversal/DepthFirstTraverse/manifest.mf
@@ -0,0 +1,3 @@
+Manifest-Version: 1.0
+X-COMMENT: Main-Class will be added automatically by build
+
diff --git a/Algorithms/Traversal/DepthFirstTraverse/nbproject/build-impl.xml b/Algorithms/Traversal/DepthFirstTraverse/nbproject/build-impl.xml
new file mode 100644
index 0000000..0e3fcd4
--- /dev/null
+++ b/Algorithms/Traversal/DepthFirstTraverse/nbproject/build-impl.xml
@@ -0,0 +1,1768 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Must set src.dir
+ Must set test.src.dir
+ Must set build.dir
+ Must set dist.dir
+ Must set build.classes.dir
+ Must set dist.javadoc.dir
+ Must set build.test.classes.dir
+ Must set build.test.results.dir
+ Must set build.classes.excludes
+ Must set dist.jar
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Must set javac.includes
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ No tests executed.
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Must set JVM to use for profiling in profiler.info.jvm
+ Must set profiler agent JVM arguments in profiler.info.jvmargs.agent
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Must select some files in the IDE or set javac.includes
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ To run this application from the command line without Ant, try:
+
+ java -jar "${dist.jar.resolved}"
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Must select one file in the IDE or set run.class
+
+
+
+ Must select one file in the IDE or set run.class
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Must select one file in the IDE or set debug.class
+
+
+
+
+ Must select one file in the IDE or set debug.class
+
+
+
+
+ Must set fix.includes
+
+
+
+
+
+
+
+
+
+ This target only works when run from inside the NetBeans IDE.
+
+
+
+
+
+
+
+
+ Must select one file in the IDE or set profile.class
+ This target only works when run from inside the NetBeans IDE.
+
+
+
+
+
+
+
+
+ This target only works when run from inside the NetBeans IDE.
+
+
+
+
+
+
+
+
+
+
+
+
+ This target only works when run from inside the NetBeans IDE.
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Must select one file in the IDE or set run.class
+
+
+
+
+
+ Must select some files in the IDE or set test.includes
+
+
+
+
+ Must select one file in the IDE or set run.class
+
+
+
+
+ Must select one file in the IDE or set applet.url
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Must select some files in the IDE or set javac.includes
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Some tests failed; see details above.
+
+
+
+
+
+
+
+
+ Must select some files in the IDE or set test.includes
+
+
+
+ Some tests failed; see details above.
+
+
+
+ Must select some files in the IDE or set test.class
+ Must select some method in the IDE or set test.method
+
+
+
+ Some tests failed; see details above.
+
+
+
+
+ Must select one file in the IDE or set test.class
+
+
+
+ Must select one file in the IDE or set test.class
+ Must select some method in the IDE or set test.method
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Must select one file in the IDE or set applet.url
+
+
+
+
+
+
+
+
+ Must select one file in the IDE or set applet.url
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/Algorithms/Traversal/DepthFirstTraverse/nbproject/genfiles.properties b/Algorithms/Traversal/DepthFirstTraverse/nbproject/genfiles.properties
new file mode 100644
index 0000000..436fa7e
--- /dev/null
+++ b/Algorithms/Traversal/DepthFirstTraverse/nbproject/genfiles.properties
@@ -0,0 +1,8 @@
+build.xml.data.CRC32=626fba0e
+build.xml.script.CRC32=a3ac841b
+build.xml.stylesheet.CRC32=f85dc8f2@1.90.1.48
+# This file is used by a NetBeans-based IDE to track changes in generated files such as build-impl.xml.
+# Do not edit this file. You may delete it but then the IDE will never regenerate such files for you.
+nbproject/build-impl.xml.data.CRC32=626fba0e
+nbproject/build-impl.xml.script.CRC32=ee1df144
+nbproject/build-impl.xml.stylesheet.CRC32=3a2fa800@1.90.1.48
diff --git a/Algorithms/Traversal/DepthFirstTraverse/nbproject/project.properties b/Algorithms/Traversal/DepthFirstTraverse/nbproject/project.properties
new file mode 100644
index 0000000..b5b85ed
--- /dev/null
+++ b/Algorithms/Traversal/DepthFirstTraverse/nbproject/project.properties
@@ -0,0 +1,109 @@
+annotation.processing.enabled=true
+annotation.processing.enabled.in.editor=false
+annotation.processing.processors.list=
+annotation.processing.run.all.processors=true
+annotation.processing.source.output=${build.generated.sources.dir}/ap-source-output
+application.title=DepthFirstTraverse
+application.vendor=yashs
+build.classes.dir=${build.dir}/classes
+build.classes.excludes=**/*.java,**/*.form
+# This directory is removed when the project is cleaned:
+build.dir=build
+build.generated.dir=${build.dir}/generated
+build.generated.sources.dir=${build.dir}/generated-sources
+# Only compile against the classpath explicitly listed here:
+build.sysclasspath=ignore
+build.test.classes.dir=${build.dir}/test/classes
+build.test.results.dir=${build.dir}/test/results
+# Uncomment to specify the preferred debugger connection transport:
+#debug.transport=dt_socket
+debug.classpath=\
+ ${run.classpath}
+debug.modulepath=\
+ ${run.modulepath}
+debug.test.classpath=\
+ ${run.test.classpath}
+debug.test.modulepath=\
+ ${run.test.modulepath}
+# Files in build.classes.dir which should be excluded from distribution jar
+dist.archive.excludes=
+# This directory is removed when the project is cleaned:
+dist.dir=dist
+dist.jar=${dist.dir}/DepthFirstTraverse.jar
+dist.javadoc.dir=${dist.dir}/javadoc
+dist.jlink.dir=${dist.dir}/jlink
+dist.jlink.output=${dist.jlink.dir}/DepthFirstTraverse
+endorsed.classpath=
+excludes=
+file.reference.CustomException.jar=C:\\Users\\yashs\\Documents\\Projects\\Java\\CustomException\\dist\\CustomException.jar
+file.reference.Graph.jar=C:\\Users\\yashs\\Documents\\Projects\\Java\\DataStructures\\Graph\\dist\\Graph.jar
+file.reference.hamcrest-core-1.3.jar=C:\\Users\\yashs\\Documents\\netbeans\\platform\\modules\\ext\\hamcrest-core-1.3.jar
+file.reference.junit-4.12.jar=C:\\Users\\yashs\\Documents\\netbeans\\platform\\modules\\ext\\junit-4.12.jar
+file.reference.LinkedList.jar=C:\\Users\\yashs\\Documents\\Projects\\Java\\DataStructures\\LinkedList\\dist\\LinkedList.jar
+file.reference.Stack.jar=C:\\Users\\yashs\\Documents\\Projects\\Java\\DataStructures\\Stack\\dist\\Stack.jar
+includes=**
+jar.compress=false
+javac.classpath=\
+ ${file.reference.Graph.jar}:\
+ ${file.reference.Stack.jar}:\
+ ${file.reference.CustomException.jar}:\
+ ${file.reference.LinkedList.jar}:\
+ ${file.reference.hamcrest-core-1.3.jar}:\
+ ${file.reference.junit-4.12.jar}
+# Space-separated list of extra javac options
+javac.compilerargs=
+javac.deprecation=false
+javac.external.vm=true
+javac.modulepath=
+javac.processormodulepath=
+javac.processorpath=\
+ ${javac.classpath}
+javac.source=1.8
+javac.target=1.8
+javac.test.classpath=\
+ ${javac.classpath}:\
+ ${build.classes.dir}
+javac.test.modulepath=\
+ ${javac.modulepath}
+javac.test.processorpath=\
+ ${javac.test.classpath}
+javadoc.additionalparam=
+javadoc.author=false
+javadoc.encoding=${source.encoding}
+javadoc.html5=false
+javadoc.noindex=false
+javadoc.nonavbar=false
+javadoc.notree=false
+javadoc.private=false
+javadoc.splitindex=true
+javadoc.use=true
+javadoc.version=false
+javadoc.windowtitle=
+# The jlink additional root modules to resolve
+jlink.additionalmodules=
+# The jlink additional command line parameters
+jlink.additionalparam=
+jlink.launcher=true
+jlink.launcher.name=DepthFirstTraverse
+main.class=depthfirsttraverse.DepthFirstTraverse
+manifest.file=manifest.mf
+meta.inf.dir=${src.dir}/META-INF
+mkdist.disabled=false
+platform.active=default_platform
+run.classpath=\
+ ${javac.classpath}:\
+ ${build.classes.dir}
+# Space-separated list of JVM arguments used when running the project.
+# You may also define separate properties like run-sys-prop.name=value instead of -Dname=value.
+# To set system properties for unit tests define test-sys-prop.name=value:
+run.jvmargs=
+run.modulepath=\
+ ${javac.modulepath}
+run.test.classpath=\
+ ${javac.test.classpath}:\
+ ${build.test.classes.dir}
+run.test.modulepath=\
+ ${javac.test.modulepath}
+source.encoding=UTF-8
+src.dir=src
+test.src.dir=test
diff --git a/Algorithms/Traversal/DepthFirstTraverse/nbproject/project.xml b/Algorithms/Traversal/DepthFirstTraverse/nbproject/project.xml
new file mode 100644
index 0000000..16e3e2c
--- /dev/null
+++ b/Algorithms/Traversal/DepthFirstTraverse/nbproject/project.xml
@@ -0,0 +1,15 @@
+
+
+ org.netbeans.modules.java.j2seproject
+
+
+ DepthFirstTraverse
+
+
+
+
+
+
+
+
+
diff --git a/Algorithms/Traversal/DepthFirstTraverse/src/depthfirsttraverse/DepthFirstTraverse.java b/Algorithms/Traversal/DepthFirstTraverse/src/depthfirsttraverse/DepthFirstTraverse.java
new file mode 100644
index 0000000..b6cb228
--- /dev/null
+++ b/Algorithms/Traversal/DepthFirstTraverse/src/depthfirsttraverse/DepthFirstTraverse.java
@@ -0,0 +1,58 @@
+package depthfirsttraverse;
+
+import customexception.CustomException;
+import graph.Edge;
+import graph.Graph;
+import java.util.ArrayList;
+import java.util.HashSet;
+import stack.Stack;
+
+/**
+ *
+ * @author Yash Shah
+ */
+public class DepthFirstTraverse
+{
+ /**
+ * Traverse the graph Depth First
+ *
+ */
+ public static void
+ traverse(Graph graph)
+ {
+ HashSet visited = new HashSet<>();
+
+ Stack nodes = new Stack<>();
+ String current = graph.getNodes().get(0).getValue();
+ // Push current node to the stack
+ nodes.push(current);
+ // Add current node to visited set
+ visited.add(current);
+
+ while(!nodes.isEmpty())
+ {
+ current = nodes.pop();
+ System.out.println(current);
+ try
+ {
+ // Get adjecency
+ ArrayList adjecency = graph.getEdges(current);
+ // Traverse through all adjecency edges
+ // Put all adjecent nodes in stack, if not visited
+ for(Edge e: adjecency)
+ {
+ String adjecent = e.getDestination().toString();
+ if(!visited.contains(adjecent))
+ {
+ nodes.push(adjecent);
+ visited.add(adjecent);
+ }
+ }
+ }
+ catch(CustomException e)
+ {
+ System.err.println("[ERROR] " + e.getMessage());
+ }
+ }
+ }
+}
diff --git a/Algorithms/Traversal/DepthFirstTraverse/test/depthfirsttraverse/DepthFirstTraverseTest.java b/Algorithms/Traversal/DepthFirstTraverse/test/depthfirsttraverse/DepthFirstTraverseTest.java
new file mode 100644
index 0000000..caf4786
--- /dev/null
+++ b/Algorithms/Traversal/DepthFirstTraverse/test/depthfirsttraverse/DepthFirstTraverseTest.java
@@ -0,0 +1,65 @@
+/*
+ * To change this license header, choose License Headers in Project Properties.
+ * To change this template file, choose Tools | Templates
+ * and open the template in the editor.
+ */
+package depthfirsttraverse;
+
+import customexception.CustomException;
+import graph.Graph;
+import org.junit.Test;
+
+/**
+ *
+ * @author Yash Shah
+ */
+public class DepthFirstTraverseTest
+{
+ /**
+ * Test of traverse method, of class DepthFirstTraverse.
+ */
+ @Test
+ public void testTraverse()
+ {
+ System.out.println("traverse");
+ DepthFirstTraverse.traverse(createNewGraph());
+ }
+
+ private Graph
+ createNewGraph()
+ {
+ Graph graph = new Graph();
+ try
+ {
+ graph.addUnidirectionalEdge("Astana", "Delhi", 4126);
+ graph.addUnidirectionalEdge("Astana", "Beijing", 4175);
+ graph.addUnidirectionalEdge("Astana", "Moscow", 2150);
+ graph.addUnidirectionalEdge("Delhi", "Singapor", 4140);
+ graph.addUnidirectionalEdge("Beijing", "Singapor", 4742);
+ graph.addUnidirectionalEdge("Beijing", "Tokyo", 2098);
+ graph.addUnidirectionalEdge("Moscow", "London", 2498);
+ graph.addUnidirectionalEdge("Moscow", "Algiers", 3336);
+ graph.addUnidirectionalEdge("Moscow", "Barcelona", 3006);
+ graph.addUnidirectionalEdge("Singapor", "Brisbane", 6152);
+ graph.addUnidirectionalEdge("Tokyo", "Honolulu", 6195);
+ graph.addUnidirectionalEdge("Tokyo", "Anchorage", 5555);
+ graph.addUnidirectionalEdge("London", "Boston", 5264);
+ graph.addUnidirectionalEdge("Algiers", "San Juan", 7015);
+ graph.addUnidirectionalEdge("Barcelona", "Boston", 5861);
+ graph.addUnidirectionalEdge("Brisbane", "Honolulu", 7566);
+ graph.addUnidirectionalEdge("Honolulu", "San Fransicso", 3851);
+ graph.addUnidirectionalEdge("Anchorage", "Vancouver", 2129);
+ graph.addUnidirectionalEdge("Boston", "Vancouver", 4022);
+ graph.addUnidirectionalEdge("San Juan", "Houston", 3178);
+ graph.addUnidirectionalEdge("San Juan", "Helena", 5194);
+ graph.addUnidirectionalEdge("San Fransicso", "Vancouver", 1276);
+ graph.addUnidirectionalEdge("Houston", "Vancouver", 3184);
+ graph.addUnidirectionalEdge("Helena", "Vancouver", 880);
+ }
+ catch (CustomException ex)
+ {
+ System.err.println(ex.getMessage());
+ }
+ return graph;
+ }
+}
diff --git a/Algorithms/Traversal/README.md b/Algorithms/Traversal/README.md
new file mode 100644
index 0000000..5eca657
--- /dev/null
+++ b/Algorithms/Traversal/README.md
@@ -0,0 +1,5 @@
+**This repository contains different types of traversal algorithms written in Java programming language**
+
+## List of projects ##
+1. [Breadth First Traversal](https://github.com/yashshah03/Java/tree/master/Algorithms/Traversal/BreadthFirstTraverse)
+2. [Depth First Traversal](https://github.com/yashshah03/Java/tree/master/Algorithms/Traversal/DepthFirstTraverse)
diff --git a/DataStructures/Graph/src/graph/Graph.java b/DataStructures/Graph/src/graph/Graph.java
index d2b991d..f043659 100644
--- a/DataStructures/Graph/src/graph/Graph.java
+++ b/DataStructures/Graph/src/graph/Graph.java
@@ -1,11 +1,10 @@
package graph;
-import java.util.HashMap;
import java.util.Map;
-
import customexception.CustomException;
import java.util.ArrayList;
import java.util.HashSet;
+import java.util.LinkedHashMap;
/**
*
@@ -19,9 +18,10 @@ public class Graph
public Graph()
{
- edgeList = new HashMap();
- nodeList = new HashMap();
- srcDstList = new HashMap();
+ // Using linkedHashMap instead of HashMap to keep insertion order
+ edgeList = new LinkedHashMap();
+ nodeList = new LinkedHashMap();
+ srcDstList = new LinkedHashMap();
}
/**
@@ -332,7 +332,6 @@ public Graph()
nodeList.values().forEach((node) -> {
nodes.add(node);
});
-
return nodes;
}
diff --git a/DataStructures/Graph/test/graph/GraphTest.java b/DataStructures/Graph/test/graph/GraphTest.java
index daf0f28..1a14d61 100644
--- a/DataStructures/Graph/test/graph/GraphTest.java
+++ b/DataStructures/Graph/test/graph/GraphTest.java
@@ -505,4 +505,41 @@ public void testPrintNodes()
});
instance.printNodes();
}
+
+ /**
+ * Test of getNodes method, of class Graph.
+ *
+ */
+ @Test
+ public void testGetNodes()
+ {
+ System.out.println("getNodes");
+ Graph graph = new Graph();
+ ArrayList list = new ArrayList(Arrays.asList("D-A-5",
+ "B-F-6",
+ "C-E-7",
+ "E-F-8",
+ "A-B-2",
+ "A-C-3",
+ "A-D-4",
+ "D-F-9"));
+ list.forEach((w) -> {
+ String[] places = w.split("-");
+ try
+ {
+ graph.addUnidirectionalEdge(places[0],
+ places[1],
+ Integer.parseInt(places[2]));
+ }
+ catch (CustomException ex)
+ {
+ System.err.println("testGetNodes: " + ex.getMessage());
+ }
+ });
+ ArrayList nodes = graph.getNodes();
+ nodes.forEach((node)->{
+ System.out.print(node.getValue() + " - ");
+ });
+ System.out.println();
+ }
}
diff --git a/README.md b/README.md
index 1ca1726..7c2370d 100644
--- a/README.md
+++ b/README.md
@@ -2,15 +2,23 @@
## List of projects ##
1. [Datastructures](https://github.com/yashshah03/Java/tree/master/DataStructures)
- - [LinkedList](https://github.com/yashshah03/Java/tree/master/DataStructures/LinkedList)
- - [Queue](https://github.com/yashshah03/Java/tree/master/DataStructures/Queue)
- - [Stack](https://github.com/yashshah03/Java/tree/master/DataStructures/Stack)
- - [Binary Tree](https://github.com/yashshah03/Java/tree/master/DataStructures/BinaryTree)
- - [Binary Search Tree](https://github.com/yashshah03/Java/tree/master/DataStructures/BinarySearchTree)
- - [Word Trie](https://github.com/yashshah03/Java/tree/master/DataStructures/WordTrie)
- - [Graph](https://github.com/yashshah03/Java/tree/master/DataStructures/Graph)
+ 1. [LinkedList](https://github.com/yashshah03/Java/tree/master/DataStructures/LinkedList)
+ 2. [Queue](https://github.com/yashshah03/Java/tree/master/DataStructures/Queue)
+ 3. [Stack](https://github.com/yashshah03/Java/tree/master/DataStructures/Stack)
+ 4. [Binary Tree](https://github.com/yashshah03/Java/tree/master/DataStructures/BinaryTree)
+ 5. [Binary Search Tree](https://github.com/yashshah03/Java/tree/master/DataStructures/BinarySearchTree)
+ 6. [Word Trie](https://github.com/yashshah03/Java/tree/master/DataStructures/WordTrie)
+ 7. [Graph](https://github.com/yashshah03/Java/tree/master/DataStructures/Graph)
2. [Custom Exception](https://github.com/yashshah03/Java/tree/master/CustomException)
3. [Algorithms](https://github.com/yashshah03/Java/tree/master/Algorithms)
- - [Breadth First Search Algorithm](https://github.com/yashshah03/Java/tree/master/Algorithms/BreadthFirstSearch)
- - [Depth First Search Algorithm](https://github.com/yashshah03/Java/tree/master/Algorithms/DepthFirstSearch)
- - [Dijkstra's Algorithm](https://github.com/yashshah03/Java/tree/master/Algorithms/Dijkstra)
\ No newline at end of file
+ 1. [Traversal](https://github.com/yashshah03/Java/tree/master/Algorithms/Traversal)
+ 1. [Breadth First Traversal](https://github.com/yashshah03/Java/tree/master/Algorithms/Traversal/BreadthFirstTraverse)
+ 2. [Depth First Traversal](https://github.com/yashshah03/Java/tree/master/Algorithms/Traversal/DepthFirstTraverse)
+ 2. [Graph](https://github.com/yashshah03/Java/tree/master/Algorithms/Graph)
+ 1. [Dijkstra's Single-Source Shortest Path](https://github.com/yashshah03/Java/tree/master/Algorithms/Graph/Dijkstra)
+ 3. [Search](https://github.com/yashshah03/Java/tree/master/Algorithms/Search)
+ 1. [Binary Search](https://github.com/yashshah03/Java/tree/master/Algorithms/Search/BinarySearch)
+ 2. [Breadth First Search](https://github.com/yashshah03/Java/tree/master/Algorithms/Search/BreadthFirstSearch)
+ 3. [Depth First Search](https://github.com/yashshah03/Java/tree/master/Algorithms/Search/DepthFirstSearch)
+ 4. [Sort](https://github.com/yashshah03/Java/tree/master/Algorithms/Sort)
+ 1. [Counting Sort](https://github.com/yashshah03/Java/tree/master/Algorithms/Sort/CountingSort)
diff --git a/_config.yml b/_config.yml
deleted file mode 100644
index ddeb671..0000000
--- a/_config.yml
+++ /dev/null
@@ -1 +0,0 @@
-theme: jekyll-theme-time-machine
\ No newline at end of file