Question: public void unknown ( ) { if ( topOfStack = = - 1 ) return; ArrayStack st = new ArrayStack ( ) ; while (

public void unknown()
{ if (topOfStack==-1) return;
ArrayStack st= new ArrayStack();
while(! isEmpty())
st.push(pop());
if (((Comparable)st.theData[topOfStack]).compareTo((Comparable)st.theData[0])>0)
st.theData[topOfStack]= theData[0];
}
a)this stack will be in the reverse order of st stack, but with its top of stack as the same topOfStack in the original this stack if the last element in the original st stack greater than the bottom element of the original st stack.
b)St will be in the reverse order of this stack, but with its top of stack as the same topOfStack in the original st stack if the last element in the original this stack greater than the bottom element of the original this stack.
c)St will be in the reverse order of this stack, but with its top of stack as the same topOfStack in the original this stack if the last element in the original this stack smaller than the bottom element of the original this stack.
d)St will be in the reverse order of this stack, but with its top of stack as the same topOfStack in the original this stack if the last element in the original this stack greater than the bottom element of the original this stack.

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 Programming Questions!