Welcome to the Data Structures in Java repository! This project provides clean and well-documented implementations of fundamental data structures in Java. It serves as a learning resource for students, developers, and anyone interested in understanding how data structures work under the hood.
This repository contains Java implementations of various data structures, each in its own source file. The code is designed to be simple, readable, and reusable, making it ideal for educational purposes or as a reference for building more complex applications.
The following data structures are included in this repository:
- ArrayList: A dynamic array implementation with resizing capabilities.
- LinkedList: A singly or doubly linked list with basic operations (add, remove, etc.).
- Stack: A LIFO (Last In, First Out) data structure with push and pop operations.
- Queue: A FIFO (First In, First Out) data structure with enqueue and dequeue operations.
- Binary Search Tree (BST): A tree-based structure with efficient search, insert, and delete operations.
- AVL Tree: A self-balancing binary search tree for optimized performance.
- Hash Table: A key-value store with hashing for fast lookups.
- Heap: A priority queue implementation (min-heap or max-heap).
- Graph: Basic graph representation with adjacency list/matrix (if applicable).
Each data structure is implemented in a separate file under the src/ directory.
- Java Development Kit (JDK): Version 8 or higher.
- A Java IDE (e.g., IntelliJ IDEA, Eclipse) or a text editor with a Java compiler.
- Clone the repository:
git clone https://github.com/sercankulcu/data-structures-java.git
- Navigate to the project directory:
cd data-structures-java - Compile and run the desired Java file(s) using a Java compiler or IDE:
Note: Most files contain standalone implementations without a
javac src/<DataStructure>.java
mainmethod. You can create a test class to use these data structures.
Each data structure is implemented as a Java class with methods for common operations (e.g., insert, delete, search). To use a data structure:
- Import the desired class into your Java project.
- Create an instance of the data structure and call its methods. For example:
ArrayList list = new ArrayList(); list.add(42); System.out.println(list.get(0)); // Outputs: 42
Refer to the source code in src/ for detailed method signatures and implementations.
Contributions are welcome! If you'd like to add new data structures, improve existing implementations, or fix bugs, please follow these steps:
- Fork the repository.
- Create a new branch (
git checkout -b feature/your-feature). - Commit your changes (
git commit -m "Add your feature"). - Push to the branch (
git push origin feature/your-feature). - Open a pull request.
Please ensure your code follows Java coding conventions and includes appropriate comments.
This project is licensed under the MIT License. See the LICENSE file for details.
For questions or suggestions, feel free to contact the repository owner, Sercan Kulcu, or open an issue on GitHub.
Happy coding!