Question: 3 : Given an CircularArrayQueue class implementing a queue using an array: class CircularArrayQueue { private: int array [ 1 0 ] ; / /

3: Given an CircularArrayQueue class implementing a queue using an array:
class CircularArrayQueue
{
private: int array[10]; //size is 10
int front; //index of item to dequeue
int back; //index of item to enqueue
public: CircularArrayQueue() : array {0}, front(0), back(9){}
void enqueue(int i);
int dequeue();
...};
Match the blanks with the corresponding code for void enqueue(int i) and int dequeue():
void CircularArrayQueue::enqueue(int i)
{
if(____A____)
{
____B____;
array[back]=i;
}
}
int CircularArrayQueue::dequeue()
{
int val =-1;
if(____C____)
{
val = array[front];
____D____;
}
return val;

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Programming Questions!