0

Can someone please double check to make sure I have these right. Here are the instructions...

Assume that q is a queue implemented as described using circular array with queueElement = char and capacity 5, and then ch is of type char. Show the values of myFront and myBack and the contents of myArray for the Queue object q after the program segment has been executed, also indicate any errors that occur...

1.

q.enqueue('X');

q.enqueue('Y');

q.enqueue('Z');

while (!q.empty())

{

ch = q.front();

q.dequeue();

}

For this one I put myFront = 3 and myBack = 4 but dont know what yo do for myArray

3.

ch = 'A';

for (int i = 1; i <=4; i++)

{

q.enqueue(ch);

ch++;

q.enqueue(ch);

ch = q.front();

q.dequeue();

}

For this one I put myFront = 1, myBack = 4 and also not sure what to pout for myArray...can someone please take a look and offer assistance. I need this to be looked at by 5. I apologize for the short notice.

2
Contributors
2
Replies
3
Views
7 Years
Discussion Span
Last Post by jimJohnson
0

Apologies

1.

q.enqueue('X');

q.enqueue('Y');

q.enqueue('Z');

while (!q.empty())

{

ch = q.front();

q.dequeue();

}



For this one I put myFront = 3 and myBack = 4 but dont know what yo do for myArray





3.

ch = 'A';

for (int i = 1; i <=4; i++)

{

q.enqueue(ch);

ch++;

q.enqueue(ch);

ch = q.front();

q.dequeue();

}
This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.