Problem: You need to write a recursive algorithm that reverses a Queue. You should only use the following Queue interfac
-
answerhappygod
- Site Admin
- Posts: 899604
- Joined: Mon Aug 02, 2021 8:13 am
Problem: You need to write a recursive algorithm that reverses a Queue. You should only use the following Queue interfac
Problem: You need to write a recursive algorithm that reverses a Queue. You should only use the following Queue interfaces. .add(e): enqueues element e on to the queue .remove(): dequeues and returns the element at the front of the queue isEmpty(): retiurns true if and only if the queue has no elements Hint: the solution is only 4-5 lines long. input: Q Queue that is to be reversed output: A queue with the elements in reversed order // Your pseudo code here
Join a community of subject matter experts. Register for FREE to view solutions, replies, and use search function. Request answer by replying!