A doubly queue is a linear data structure which enables the user to add and remove
integers from either ends, i.e. from front or rear. Define a class Dequeue with the following details:
Class name: Dequeue
Data members/instance variables:
arr[ ]: array to hold up to 100 integer elements lim: stores the limit of the dequeue
front: to point to the index of the front end
rear: to point to the index of the rear end
Member functions:
Dequeue(int 1): constructor to initialize the data members lim = 1; front = rear = 0
void addfront(int val): to add integer from the front if possible else display the message (“Overflow from front”) voidaddrear(intval): to add integer from the rear if
possible else display the message (“Overflow from rear”)
int popfront(): returns element from front, if possible otherwise returns – 9999
int poprear(): returns element from rear, if possible otherwise returns – 9999
Specify the class Dequeue giving details of the constructor (int), void addfront(int), void addrear (int, popfront ( ) and int poprear ( ). The main function and algorithm need not be written.
Specify the class Dequeue giving details of the constructor (int),
void addfront(int), void addrear (int, popfront ( ) and int poprear ( ). The main function and algorithm need not be written.