Question: Write a java program to finish the reverse operations of a Array Queue The reverseQueue method take a Myqueue object as input, and return a

Write a java program to finish the reverse operations of a Array Queue The reverseQueue method take a Myqueue object as input, and return a reversed queue. You need to use enqueue, dequeue to solve this problem. For example, Input: 1 4 7 9 2 Output: 2 9 7 4 1 Input: 3 3 4 1 2 Output: 2 1 4 3 3 The signature of the method is : private static MyQueue reverse(MyQueue queue);

Here comes the struture of the MyQueue class:

public class MyQueue Attributes: private int front, rear, size; // the index for firs, the index for last array and current size of your queue private String[] queueArray; // an array to save all elements in your queue private int maxSize; // the maximum size of your queue Methods: public void enqueue(String s); public String dequeue(); public boolean isEmpty(); public boolean isFull();

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 Databases Questions!