Last Updated: 16 November, 2024 4 Mins Read
A Queue is a linear data structure to store and manipulate the data elements. A queue follows the concept of "First in, First out" (FIFO), where the first element inserted into the queue is the first one to be deleted from the queue.
A queue is open at both ends which enables insert operations to be performed at one end called REAR or TAIL and delete operations to be performed at another end called FRONT or HEAD.
Enqueue: Add a new element to the end of the queue.
Dequeue: Remove an element from the front of the queue.
Peek or front: Retrieve the frontmost element in the queue without deleting it.
rear: Returns the element at the end in the queue without deleting it.
isFull: Checks if the queue is full.
Class: QueueImplUsingArray
Output
Queue is Empty 20 30 40 50 20 30 40 50 60 Queue elements after two node deletions: 40 50 60 Queue elements after one insertion: 40 50 60 60 Queue Front Element is: 40
That's all, guys. I hope this article is helpful for you.
Happy Learning... 😀
feedback@javabytechie.com