Assume the following method is added to the ArrayQueue class. What does this method do? public void undefined() { if(size==0) return; E item; int f = front; int r = rear; for (int i = 0;i < size/2; i++) { item = theData(f): theData[f] = theData[r); theData[r] = item; f= (f + 1)%capacity: r = (r - 1 + capacity)%capacity: A Makes the front as rear and the rear as front. B Exchanges the first and the last elements in the queue. Reverses the queue. Reverses the first half of the queue.

Programming Logic & Design Comprehensive
9th Edition
ISBN:9781337669405
Author:FARRELL
Publisher:FARRELL
Chapter9: Advanced Modularization Techniques
Section: Chapter Questions
Problem 2GZ
icon
Related questions
Question
Assume the following method is added to the ArrayQueue class. What does this method do?
public void undefined()
{
if(size==0) return;
E item;
int f = front;
int r = rear;
for (int i = 0:i < size/2; i++)
{
item = theData[f];
theData[f] = theData[r];
theData[r] = item;
f = (f + 1)%capacity:
r= (r - 1 + capacity)%capacity:
}
(A Makes the front as rear and the rear as front.
(B Exchanges the first and the last elements in the queue.
Reverses the queue.
D Reverses the first half of the queue.
Transcribed Image Text:Assume the following method is added to the ArrayQueue class. What does this method do? public void undefined() { if(size==0) return; E item; int f = front; int r = rear; for (int i = 0:i < size/2; i++) { item = theData[f]; theData[f] = theData[r]; theData[r] = item; f = (f + 1)%capacity: r= (r - 1 + capacity)%capacity: } (A Makes the front as rear and the rear as front. (B Exchanges the first and the last elements in the queue. Reverses the queue. D Reverses the first half of the queue.
Expert Solution
steps

Step by step

Solved in 2 steps

Blurred answer
Knowledge Booster
Array
Learn more about
Need a deep-dive on the concept behind this application? Look no further. Learn more about this topic, computer-science and related others by exploring similar questions and additional content below.
Similar questions
  • SEE MORE QUESTIONS
Recommended textbooks for you
Programming Logic & Design Comprehensive
Programming Logic & Design Comprehensive
Computer Science
ISBN:
9781337669405
Author:
FARRELL
Publisher:
Cengage