‹ Back to the paper
Circular Queue is a linear data structure in which the operations are performed based on FIFO…
Circular Queue is a linear data structure in which the operations are performed based on FIFO (First In First Out) principle and the last position is connected back to the first position to make a circle.
Define a class Cqueue with the following details:
Class name : Cqueue
Data member/instance variable:
ele[ ] : array to hold the integer elements
cap : stores the maximum capacity of the array
front : to point the index of the front
rear : to point the index of the rear.
Member functions/methods:
Cqueue(int max) : constructor to initialize the data member cap = max, front = rear = 0 and create the integer array
void insert(int v) : to add integers from the front index if possible else display the message(“full from rear”)
int delete( ) : to remove and return elements from rear, if any, else returns -999
void display() : to display elements of circular queue
Specify the class Cqueue giving the details of void insert(int) and int delete( ). Assume that the other functions have been defined.
The main( ) function and algorithm need NOT be written.
Answer
No answer yet.
From ISC 2020 Specimen Computer Science Paper 1, question 11.