Java • Data Structures • Algorithms • Generics
This repository provides a generic implementation of a Hybrid Stack in Java together with several stack-based algorithms.
The implementation combines the advantages of linked structures and fixed-size arrays by representing the stack as a linked list of array blocks. This hybrid approach reduces pointer overhead while maintaining dynamic growth.
The project was developed as part of my study of Data Structures and Algorithms, with emphasis on algorithmic correctness, clean object-oriented design, and code readability.
- Generic implementation using Java Generics
- Hybrid stack architecture (linked list of fixed-size arrays)
- Constant-time push and pop operations (amortized)
- Clean object-oriented design
- Stack visualization
- Demonstration program
- Stack-based algorithmic applications
- push() → O(1) (amortized)
- pop() → O(1) (amortized)
- top() → O(1)
- isEmpty() → O(1)
- display() → O(n)
Finds and removes all occurrences of the minimum element using only stack operations together with a helper queue.
Finds and removes all occurrences of the minimum element using only stack operations together with a helper stack.
Compresses consecutive equal values into (frequency, value) pairs while preserving the original order of the stack.
src/
└── datastructures/
└── stack/
├── HybridStack.java
├── CircularQueue.java
├── StackAlgorithms.java
└── Main.java
Compile
javac src/datastructures/stack/*.javaRun
java -cp src datastructures.stack.MainThis project demonstrates:
- Generic programming in Java
- Implementation of Abstract Data Types (ADTs)
- Hybrid memory organization
- Stack-based algorithmic techniques
- Algorithm complexity analysis
- Object-oriented software design
Potential future extensions include:
- Dynamic block resizing
- Iterator support
- JUnit test suite
- Javadoc documentation
- Additional stack-based algorithms
- Performance benchmarking
- Maven/Gradle support
This project is licensed under the MIT License.
Developed by Anastasis Zachariou