Ecosyste.ms: Awesome

An open API service indexing awesome lists of open source software.

Awesome Lists | Featured Topics | Projects

https://github.com/idriskulubi/queue-data-structure-in-java


https://github.com/idriskulubi/queue-data-structure-in-java

Last synced: 9 days ago
JSON representation

Awesome Lists containing this project

README

        

## Queue Data Structure
===============================

I was practising data structures and algorithms in java. I came across a problem where I had to implement the queue
## THIS IS MY UNDERSTANDING ON QUEUES DATA STRUCTURE:
===============================

A queue is a linear data structure that follows the First-In, First-Out (FIFO)
principle. This means that the element added first will be removed first. In other words,
the oldest element in the queue is always served or returned first. The operations on this
data structure are:
1. **Enqueue** - Add an element to the end of the queue. If the
queue is full, then it should throw an exception.
2. **Dequeue** - Remove and return the front element from the queue. If the
queue is empty, then it should throw an exception.
3. **IsEmpty** - Return true if the queue is empty, otherwise false.
4. **IsFull** - Return true if the queue is full, otherwise false.
5. **Peek** - Return the value of the front element without removing it. If the
queue is empty, then it should throw an exception.
6. **Size** - Return the number of elements currently present in the queue.
7. **PrintQueue** – Print all the elements present in the queue separated by commas.
8. Implement the code for the above methods using appropriate data structures.
You can use any programming language you prefer.💻

## Note:
You can use an array or linked list to implement the queue.
Make sure to handle exceptions appropriately.
Test your implementation with different test cases.
Have fun coding! 🚀