A comprehensive collection of custom Java data structure implementations built for learning, experimentation, and testing of core abstract data types (ADTs). Each interface includes multiple implementations, demonstrating different design approaches and internal data structures.
ds/
├── map/
│ ├── IMap.java // Map Interface
│ ├── Map1.java // HashMap-Based Map
│ ├── Map2.java // Dual Queue-Backed Map
│ ├── Map3.java // Bucketed Hash Map
│ └── Map4.java // BST-Backed Map
│
├── heap/
│ ├── IHeap.java // Heap Interface
│ ├── Heap1.java // Array-Based Heap
│ └── Heap2.java // Binary Tree-Based Heap
│
ds/
├── list/
│ ├── IList.java // List Interface
│ ├── List1.java // Array-Based List (Dynamic Array)
│ ├── List2.java // Doubly Linked List-Based List
│ └── List3.java // Singly Linked List-Based List
│
├── queue/
│ ├── IQueue.java // Queue Interface
│ ├── Queue1.java // ArrayList-Based Queue
│ ├── Queue2.java // LinkedList-Based Queue
│ └── Queue3.java // Sequence-Backed Queue
│
├── sequence/
│ ├── ISequence.java // Sequence Interface
│ ├── Sequence1.java // ArrayList-Based Sequence
│ ├── Sequence2.java // LinkedList-Based Sequence
│ └── Sequence3.java // Two-Stack Sequence
│
├── set/
│ ├── ISet.java // Set Interface
│ ├── Set1.java // ArrayList-Based Set
│ ├── Set2.java // HashMap-Backed Set
│ ├── Set3.java // BinaryTree-Backed Set
│ └── Set4.java // Custom Hash-Bucket Set
│
├── stack/
│ ├── IStack.java // Stack Interface
│ ├── Stack1.java // ArrayList-Based Stack
│ ├── Stack2.java // LinkedList-Based Stack
│ └── Stack3.java // Sequence-Backed Stack
│
└── tree/
├── ITree.java // Tree Interface
├── Node.java // Tree Node Structure
├── BinaryTree.java // Level-Order Binary Tree
├── BinarySearchTree.java // Ordered Binary Search Tree
├── AVLTree.java // Self-Balancing Tree (Height-Based)
└── RedBlackTree.java // Self-Balancing Tree (Color-Based)
- Generic and Type-Safe: All implementations use Java Generics to ensure type safety and flexibility.
- Interface-First Design: Clear separation of interfaces and implementations for abstraction, modularity, and easy swapping of data structures.
- Map Operations: Supports
put,get,remove,containsKey,containsValue,keySet,size, andisEmpty, with multiple underlying implementations. - Tree Operations: Supports
insert,remove,contains,findMin,findMax, and in-order traversal for both general binary trees and binary search trees. - Set Operations: Supports
add,remove, andcontains, with dynamic resizing in hash-based set implementations. - Queue & Stack Operations: Standard methods like
offer/poll/peekfor queues andpush/pop/peekfor stacks. - Sequence Operations: Provides
add,remove, andentryat any position, with multiple underlying implementations for performance comparison.
| Category | Interface | Implementations |
|---|---|---|
| Map | IMap<K,V> |
Map1, Map2, Map3, Map4 |
| Queue | IQueue<T> |
Queue1, Queue2, Queue3 |
| Sequence | ISequence<T> |
Sequence1, Sequence2, Sequence3 |
| Set | ISet<T> |
Set1, Set2, Set3, Set4 |
| Stack | IStack<T> |
Stack1, Stack2, Stack3 |
| Tree | ITree<T> |
BinaryTree, BinarySearchTree |