Custom implementations of core linear data structures and abstract data types in Java, built from scratch without relying on java.util collection classes. Includes a JUnit 5 test suite for each structure.
MyList<T>interface — common contract (add, get, set, remove, sort, indexOf, iterator) implemented by both list types.MyArrayList<T>— generic dynamic array backed by a rawObject[]. Supports O(1) amortizedadd, O(n) insert/remove, and doubles capacity on overflow. ImplementsIterable<T>with an inner iterator. Contains three sort strategies selectable by name:- Bubble sort — O(n²), early-exit on no swap.
- Quick sort — O(n log n) average, in-place Lomuto partition.
- Merge sort — O(n log n) worst-case, stable.
MyLinkedList<T>— generic doubly-linked list with head/tail pointers. O(1)addFirst/addLast/removeFirst/removeLast. Sorts in-place with bubble sort.MyStack<T>— LIFO stack backed byMyLinkedList.push/pop/peekwithEmptyStackException.MyQueue<T>— FIFO queue backed byMyLinkedList.enqueue/dequeue/peek.MyMinHeap<T>— min-heap backed byMyArrayList; insert + bubble-sort to maintain order;findMinanddeleteMinin O(1) and O(n) respectively.- JUnit 5 tests — separate test classes for all five structures covering edge cases (empty, single element, boundary indices).
src/
├── main/java/
│ ├── Main.java
│ ├── lists/
│ │ ├── MyList.java # Shared interface
│ │ ├── MyArrayList.java # Dynamic array + 3 sort algorithms
│ │ └── MyLinkedList.java # Doubly-linked list
│ └── types/
│ ├── MyStack.java # LIFO stack
│ ├── MyQueue.java # FIFO queue
│ └── MyMinHeap.java # Min-heap
└── test/java/
├── lists/
│ ├── TestArrayList.java
│ └── TestLinkedList.java
└── types/
├── MyStackTest.java
├── MyQueueTest.java
└── MyMinHeapTest.java
Run tests (Gradle):
./gradlew testCompile and run manually:
javac -d out src/main/java/lists/*.java src/main/java/types/*.java src/main/java/Main.java
java -cp out MainAdil Ormanov — GitHub