Skip to content

sercankulcu/data-structures-java

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

86 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Data Structures in Java

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.

Overview

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.

Implemented Data Structures

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.

Getting Started

Prerequisites

  • Java Development Kit (JDK): Version 8 or higher.
  • A Java IDE (e.g., IntelliJ IDEA, Eclipse) or a text editor with a Java compiler.

Installation

  1. Clone the repository:
    git clone https://github.com/sercankulcu/data-structures-java.git
  2. Navigate to the project directory:
    cd data-structures-java
  3. Compile and run the desired Java file(s) using a Java compiler or IDE:
    javac src/<DataStructure>.java
    Note: Most files contain standalone implementations without a main method. You can create a test class to use these data structures.

Usage

Each data structure is implemented as a Java class with methods for common operations (e.g., insert, delete, search). To use a data structure:

  1. Import the desired class into your Java project.
  2. 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.

Contributing

Contributions are welcome! If you'd like to add new data structures, improve existing implementations, or fix bugs, please follow these steps:

  1. Fork the repository.
  2. Create a new branch (git checkout -b feature/your-feature).
  3. Commit your changes (git commit -m "Add your feature").
  4. Push to the branch (git push origin feature/your-feature).
  5. Open a pull request.

Please ensure your code follows Java coding conventions and includes appropriate comments.

License

This project is licensed under the MIT License. See the LICENSE file for details.

Contact

For questions or suggestions, feel free to contact the repository owner, Sercan Kulcu, or open an issue on GitHub.

Happy coding!

About

example java codes for data structure course

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages