Skip to content

This repository is a comprehensive collection of data structures and algorithms implemented in Java. It aims to provide clear and efficient implementations for educational purposes and practical use. The data structures are organized by difficulty level, making it easy to find and understand each concept.

License

Notifications You must be signed in to change notification settings

ShawnJeffersonWang/data-structures

Repository files navigation

Java Data Structures and Algorithms

This repository contains implementations of various data structures and algorithms in Java. The implementations cover basic, intermediate, and advanced topics to help you understand and utilize these concepts in your projects.

Table of Contents

  1. Basic Data Structures

  2. Intermediate Data Structures

  3. Advanced Data Structures

  4. Algorithms

Basic Data Structures

ArrayList

An implementation of a resizable array, similar to the built-in ArrayList in Java.

LinkedList

A doubly linked list implementation, providing efficient insertion and deletion operations.

Queue

A first-in, first-out (FIFO) data structure implementation.

Stack

A last-in, first-out (LIFO) data structure implementation.

Binary Search Tree (BST)

A tree data structure in which each node has at most two children, with the left child having a smaller value and the right child having a larger value.

Binary Tree

A tree data structure where each node has at most two children.

Intermediate Data Structures

Heap

A complete binary tree which satisfies the heap property, useful for priority queue implementations.

PriorityQueue

An advanced queue that allows for the retrieval of elements according to their priority.

BlockingQueue

A thread-safe queue that supports operations that wait for the queue to become non-empty when retrieving an element and wait for space to become available in the queue when storing an element.

Deque (Double-Ended Queue)

A queue that supports insertion and removal of elements from both ends.

Advanced Data Structures

HashMap

A data structure that implements a map interface using hashing for efficient key-value pair storage.

Disjoint Set (Union-Find)

A data structure that keeps track of a partition of a set into disjoint (non-overlapping) subsets, useful for Kruskal's algorithm and network connectivity.

Red-Black Tree

A balanced binary search tree with additional properties to ensure the tree remains balanced during insertions and deletions.

AVL Tree

A self-balancing binary search tree where the difference between heights of left and right subtrees cannot be more than one for all nodes.

B-Tree

A self-balancing tree data structure that maintains sorted data and allows for efficient insertion, deletion, and search operations.

Graph

A data structure consisting of nodes (vertices) and edges connecting pairs of nodes, useful for representing networks and relationships.

Algorithms

Depth-First Search (DFS)

An algorithm for traversing or searching tree or graph data structures, starting from the root and exploring as far as possible along each branch before backtracking.

Breadth-First Search (BFS)

An algorithm for traversing or searching tree or graph data structures, starting from the root and exploring all neighbor nodes at the present depth level before moving on to nodes at the next depth level.

Dijkstra's Algorithm

An algorithm for finding the shortest paths between nodes in a graph, which may represent, for example, road networks.

Kruskal's Algorithm

An algorithm for finding the minimum spanning tree of a graph, which finds a subset of the edges that connects all vertices together without any cycles and with the minimum possible total edge weight.

Contributing

Contributions are welcome! Please open an issue or submit a pull request with your improvements.

License

This project is licensed under the Apache License 2.0 - see the LICENSE file for details.

About

This repository is a comprehensive collection of data structures and algorithms implemented in Java. It aims to provide clear and efficient implementations for educational purposes and practical use. The data structures are organized by difficulty level, making it easy to find and understand each concept.

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages