Question: Question 3 [10 Marks) Write a method called maxAtFront to be included in class QueueEx. The method finds the maximum in a queue of integers
Question 3 [10 Marks) Write a method called maxAtFront to be included in class QueueEx. The method finds the maximum in a queue of integers ql of type ArrayQueue passed as parameter and place the maximum at the front of the queue q1, e., remove the maximum from its current position and add it at the front of the queue. Also, return the maximum found, Assume that the queue is not empty. Assume that class ArrayQueue is available for use. Use common queue operations only such as offer, poll, peek, isEmpty and copy constructor. For finding maximum you can use Iterator Example : Before method call: After method call: 10 q1: 15 30 20 25 12 30 q1: 10 20 15 25 12 front rear front rear
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
