https://github.com/an4b4515/data-structures
Most common Data-Structures and Algorithms implemented in Java from scratch ☕ ♨️
https://github.com/an4b4515/data-structures
algorithms bstree data-structures graph hashtable java linear linked-list nonlinear queue searching-algorithms sorting stack
Last synced: about 1 year ago
JSON representation
Most common Data-Structures and Algorithms implemented in Java from scratch ☕ ♨️
- Host: GitHub
- URL: https://github.com/an4b4515/data-structures
- Owner: An4b4515
- License: mit
- Created: 2024-05-16T13:15:43.000Z (almost 2 years ago)
- Default Branch: main
- Last Pushed: 2024-08-29T16:15:13.000Z (over 1 year ago)
- Last Synced: 2025-01-27T07:30:00.696Z (about 1 year ago)
- Topics: algorithms, bstree, data-structures, graph, hashtable, java, linear, linked-list, nonlinear, queue, searching-algorithms, sorting, stack
- Language: Java
- Homepage:
- Size: 37.1 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# Data-Structures & Algorithms
This repository contains some of the most commonly used data-structures and algorithms implemented in the Java programming language.
The types are *generic* meaning they can work with multiple data-types as long as they have the necessary characteristics, like being comparable.
# Compile it yourself (command-line)
The `sources` file stored in the root directory of the project, contains a list of all *compilation-units*.
You can generate this file yourself in **UNIX** by using the following command (assuming you are in the root directory of the project):
`find ./algorithms ./dataStructures -type f -iname "*.java" >sources`
After that, you can compile the program as follows:
`javac @sources -d ./bin`
This makes the compilation process easier by not explicitly stating all file paths.
# JAR File
This repository already includes the entire project's pre-compiled classes on a JAR archive file named `structures_and_algorithms.jar`.
If you want to create this file yourself, you can go to the directory you compiled the program and execute this command:
`jar -cf foo.jar ./algorithms ./dataStructures`
Then ensure all *.class* files are included:
`jar -tf foo.jar`
# Including these packages to your other projects
You need to add the path to the JAR file in the CLASSPATH *environment variable* (the place where java searches for classfiles).
Below is a simple solution to this:
- UNIX:
+ Compilation: `javac -cp ".:path_to_jar/structures_and_algorithms.jar" Main.java your_other_source_files.java`
+ Execution: `java -cp ".:path_to_jar/structures_and_algorithms.jar" Main`
- Windows:
+ Compilation: `javac -cp ".;path_to_jar/structures_and_algorithms.jar" Main.java your_other_source_files.java`
+ Execution: `java -cp ".;path_to_jar/structures_and_algorithms.jar" Main`