Question: X 1 0 1 7 : Copy Queue to a Stack Use these two interfaces to solve this problem. 1 public interface QueueADT { 2
X: Copy Queue to a Stack
Use these two interfaces to solve this problem.
public interface QueueADT
public void clear;
public boolean enqueueE it;
public E dequeue;
public E frontValue;
public int numElements;
public boolean isEmpty;
interface StackADT
public void clear;
public boolean pushE it;
public E pop;
public E topValue;
public int numElements;
public boolean isEmpty;
Write a method to remove all of the elements from the 'queue' one by one and add them to a newly created stack use a StackArray and push the values in the stack. Return this stack. If queue is null, then just return an empty stack. Make sure you use the interfaces from above.
Step by Step Solution
There are 3 Steps involved in it
1 Expert Approved Answer
Step: 1 Unlock
Question Has Been Solved by an Expert!
Get step-by-step solutions from verified subject matter experts
Step: 2 Unlock
Step: 3 Unlock
