Question: Please complete the follwoing question in python. Make sure it satisfies the test code. Note: the implementation of Stack ADT and QueueADT have not been
Please complete the follwoing question in python. Make sure it satisfies the test code.
Note: the implementation of Stack ADT and QueueADT have not been provided.

Write a function, reverse_queue(q), which takes a Queue, q, as a parameter and modifies the queue so that the elements in the queue are rearranged into reverse order You must make use of a stack to help you in reversing the elements in the queue Note: you will be defining a function that USES the Stack ADT and the Queue ADT. The implementations of both the Stack and Queue ADTs are provided to you as part of this exercise. You can simply use: Stack0, push0, pop0, is_empty0 as well as enqueue0 and dequeue0 as necessary in your function definition. For example: Test Result q1QueueO q1.enqueue(1) q1.enqueue(2) q1.enqueue(3) reverse_queue(q1) while not ql.is_empty): 3 2 1 print(q1.dequeue), end-' ') q1 = Queue() reverse_queue(q1) while not q1.is empty): print(q1.dequeueO, end-'')
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
