Implement the method below, which takes a queue of integers as an input argument and returns a
Question:
Implement the method below, which takes a queue of integers as an input argument and returns a new queue with the elements reversed.
The original input Queue should remain unchanged.
You should not use any additional data structures apart from the provided Stack and Queue.
*
For example:
if queue = (front to back) [50, 65, 92, 93] then return (front to back) [93, 92, 65, 50] if queue = (front to back) [49, 95, 8, 14, 57, 68, 1, 92] then return (front to back) [92, 1, 68, 57, 14, 8, 95, 49] if queue = (front to back) [49, 14, 44, 67, 55] then return (front to back) [55, 67, 44, 14, 49]
Parameters:
QUEUE
- input queue should be unchanged
Returns:
queue a new queue with the elements reversed based on input queue.
no system or scanner statements should appear in this.
Systems Analysis And Design
ISBN: 978-1119496489
7th Edition
Authors: Alan Dennis, Barbara Wixom, Roberta M. Roth