Operations on Linear Queue
Objective: To implement a program in C++ that performs various operations on Linear Queue, such as Enqueue, Dequeue, Front, Rear, IsEmpty, and Size.
Instructions for Students:
Implement the following operations on Linear Queue
Enqueue(Item) Operation:
- Check if the queue is full (if implementing with a fixed size).
- If not full, increment rear and add the element at rear.
Dequeue() Operation: - Check if the queue is empty.
- If not empty, check if front = rear then front = rear = -1 else front = front+1 and remove the element.
Front() Operation: - Check if the queue is empty.
- If not empty, return the element from the front of the queue.
Rear() Operation: - Check if the queue is empty.
- If not empty, return the element from the rear of the queue.
IsEmpty() Operation : - Check if front = rear = NULL.
- If Yes, return TRUE otherwise return FALSE.
IsFull() Operation : - Check if rear = MAX.
- If Yes, return TRUE otherwise return FALSE.
Size() Operation : - Check if the queue is empty
- If Yes, return -1 otherwise return rear-front+1.
this is my class question so pls answer it as i could not write code write the code in simple words and explain it properly