Question: Refer to the following code, implement the method: public NumStack join(NumStack s) public NumStack join (NumStack s) joins two stack from the bottom of each

 Refer to the following code, implement the method: public NumStack join(NumStack

Refer to the following code, implement the method: public NumStack join(NumStack s) public NumStack join (NumStack s) joins two stack from the bottom of each stack, for example, 51[2,0, 9] and s2[9,0,9], calling s1.join(s) should return a NumStack which contains(11,0,18], s1 s2 Returned NumStack 9 9 18 top bottom 2 9 11 public class NumStack implements Comparable{ private Integer[] data; private int index; public NumStack(int cap){ Yr data=new Integer[cap]; index =-1; } public boolean isEmpty(){ return index == -2;GHT } public boolean isFull() { return index==data. length -1; } public NumStack pop() { if(!isEmpty()) data[index-- ]=null; return this; } public int size() { El return index+1; } public Integer top() { if(isEmpty()) return null; return data[index]; public NumStack push(int num) { if(index

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!