A comprehensive Java library containing core data structures implemented from scratch, including lists, stacks, queues, trees, hash tables, priority queues, and a fully-functional Treap with performance analysis.
This project was developed as part of my Computer Science coursework at University College Dublin, and showcases strong Java fundamentals, algorithmic design, data structure implementation, and benchmarking.
- Singly Linked List
- Doubly Linked List
- Circular Linked List
- Array-based Stack
- LinkedList-based Stack
- Array Queue
- LinkedList Queue
- Binary Tree
- Binary Search Tree (BST)
- AVL Tree
- Red-Black Tree
- Splay Tree
- Treap (Randomized BST + heap property)
- Binary Heap
- Priority Queue implementations
- Custom Hash Table
- Map / Entry interfaces
- Collision handling logic
- Timer class for benchmarking
- Benchmark.java driver
- Utility algorithms (e.g., Bubble Sort for simple comparisons)
This project includes a full implementation of a Treap, a randomized balanced binary search tree.
We benchmarked Treap performance and compared it against:
- AVLTreeMap
- TreeMap (Javaβs built-in Red-Black Tree)
This poster illustrates:
- How a Treap works (BST + heap priority)
- Performance vs AVLTreeMap / TreeMap
- Use-cases for randomized balancing
- Conclusions from our performance testing
/src
/list
/stacksqueues
/tree
/priorityqueue
/hashtable
/interfaces
/utils
Benchmark.java
README.md
Each package contains a fully-implemented data structure and, in many cases, corresponding tests or helpers.
Clone the repository:
git clone https://github.com/Zhang-Charlie/Java-Data-Structures-Library.git
cd Java-Data-Structures-Library
Compile everything:
javac -d out $(find src -name "*.java") Benchmark.java
Run the benchmark:
java -cp out Benchmark
This project demonstrates:
- Understanding of low-level data structure behaviour
- Balanced tree rotations and priority management
- Hash table indexing and collision handling
- Algorithmic time/space complexity
- Clean object-oriented Java design
It is ideal for learning, interview preparation, or contributing to open-source educational tools.
