Question: Problem 1: reverse queue Write a function reverse in python that takes a queue as a parameter and returns a new queue in reverse order.

Problem 1: reverse queue Write a function reverse in python that takes a queue as a parameter and returns a new queue in reverse order. Your solution should not use any built-in or library functions other than those in the Stack and Queue classes provided. Example call Returns reverse( Q[1, 2, 3, 4] ) Q[4, 3, 2, 1] reverse( Q[hello] ) Q[olleh] reverse( [0] ) Q[0] Note: We are using the notation Q[ ] here to differentiate our queues from lists or arrays. Hint: use a stack to help! You can destroy the queue & make it empty
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
