Skip to content

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

7 Commits
 
 
 
 
 
 

Repository files navigation

Abstract Data Types (ADT) Implementation in Java

This project implements three fundamental Abstract Data Types (ADTs) in Java as a console-based application. It provides a menu-driven interface that allows users to interact with custom implementations of the List, Stack, and Queue data structures while demonstrating their underlying behaviour and operations.

The application implements each Abstract Data Type from scratch without using Java's built-in Collection Framework classes. Through this project, users can understand how different data structures manage data and how their operations are performed internally.

This project was developed as part of a Data Structures and Algorithms assignment to demonstrate the implementation and application of fundamental Abstract Data Types in Java.

Features

List ADT

  • Add elements to the end of the list
  • Remove elements by index
  • Retrieve elements by index
  • Display the current size of the list
  • Check whether the list is empty

Stack ADT

  • Push elements onto the stack
  • Pop elements from the stack
  • Peek at the top element
  • Display the current size of the stack
  • Check whether the stack is empty

Queue ADT

  • Enqueue elements into the queue
  • Dequeue elements from the queue
  • Peek at the front element
  • Display the current size of the queue
  • Check whether the queue is empty

User Interface

  • Menu-driven console application
  • Separate menus for List, Stack, and Queue operations
  • Continuous interaction until the user chooses to exit
  • Appropriate messages for successful and unsuccessful operations

Development Environment

  • Programming Language: Java
  • JDK Version: Java 17
  • IDE: Visual Studio Code
  • Application Type: Console Application

Project Structure

java-adt/
├── README.md
├── .gitignore
└── src/
    ├── ListADT.java
    ├── StackADT.java
    ├── QueueADT.java
    └── MainApplication.java

ListADT.java

Implements a custom List Abstract Data Type using an array to support insertion, removal, element retrieval, and basic list operations.

StackADT.java

Implements a custom Stack Abstract Data Type using an array following the Last-In-First-Out (LIFO) principle.

QueueADT.java

Implements a custom Queue Abstract Data Type using an array following the First-In-First-Out (FIFO) principle.

MainApplication.java

Provides the menu-driven interface that accepts user input and allows users to perform List, Stack, and Queue operations.

Implementation Details

The project implements three fundamental Abstract Data Types using arrays instead of Java's Collection Framework classes.

Key implementation highlights include:

  • Each data structure is implemented independently using object-oriented principles.
  • Arrays are used internally to store and manage elements.
  • The List supports insertion, removal, element retrieval, and size management.
  • The Stack follows the Last-In-First-Out (LIFO) principle using push, pop, and peek operations.
  • The Queue follows the First-In-First-Out (FIFO) principle using enqueue, dequeue, and peek operations.
  • The program validates invalid operations, such as removing elements from an empty structure or accessing an invalid index.

How to Run

  1. Clone the repository.
git clone <repository-url>
cd java-adt
  1. Compile the source files.
javac src/*.java
  1. Run the application.
java -cp src MainApplication
  1. Follow the on-screen menu to interact with the List, Stack, and Queue implementations.

Testing

The application has been tested using both functional and negative test cases to verify the correctness of all implemented operations, including:

  • List insertion, removal, retrieval, size, and empty checks
  • Stack push, pop, peek, size, and empty checks
  • Queue enqueue, dequeue, peek, size, and empty checks
  • Invalid index handling
  • Operations on empty data structures
  • Invalid menu selections

License

This project was developed as part of a university coursework assignment and is shared for educational and portfolio purposes only.

About

Java implementation of List, Stack, and Queue Abstract Data Types (ADT) using custom data structures.

Topics

Resources

Stars

Watchers

Forks

Releases

Packages

Contributors

Languages