PRASHNIKAप्रश्निका
‹ Back to the paper

A Circular queue is a linear data structure which works on the principle of FIFO, enables the user…

Computer Science20205 marksProgram
A Circular queue is a linear data structure which works on the principle of FIFO, enables the user to enter data from the rear end and remove data from the front end with the rear end connected to the front end to form a circular pattern. Define a class CirQueue with the following details: Class name : CirQueue Data members / instance variables: cq[ ] : array to store the integers cap : stores the maximum capacity of the array front : to point the index of the front end rear : to point the index of the rear end Member functions: CirQueue (int max) : constructor to initialize the data member cap=max, front=0 and rear=0 void push(int n) : to add integer in the queue from the rear end if possible, otherwise display the message “QUEUE IS FULL” int pop( ) : removes and returns the integer from the front end of the queue if any, else returns -9999 void show( ) : displays the queue elements
(a)[4.0]
Specify the class CirQueue giving details of the functions void push(int) and int pop( ). Assume that the other functions have been defined. The main function and algorithm need NOT be written.
(b)[1.0]
How is a linear queue structure different from a circular queue structure?

Answer

No answer yet.

Data structures

From ISC 2020 Computer Science Paper 1, question 10.