Question: Can anyone help me? Java Language Stack Refer to the following code, implement the method: public int compareTo (NumStack s) public class NumStack implements Comparablepublic
Stack Refer to the following code, implement the method: public int compareTo (NumStack s) public class NumStack implements Comparablepublic int compareTo (NumStack s) compares private Integer[] data; private int index; public NumStack (int cap) ( two stack from the bottom of each stack, for example, s1[2,0, 9] and s2[9,0,9], calling s1.compareTo (s2) should return data-new Integer[cap index =-1 s1 s2 op 9 9 3rd: 9-9 we get 0 public boolean isEmpty return index -1; 2nd: 0-0 we get e 1st: 2
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
