Question: public void unknown ( ) { if ( topOfStack = = - 1 ) return; ArrayStack st = new ArrayStack ( ) ; while (
public void unknown
if topOfStack return;
ArrayStack st new ArrayStack;
while isEmpty
stpushpop;
if ComparablesttheDatatopOfStackcompareToComparablesttheData
sttheDatatopOfStack theData;
athis 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.
bSt 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.
cSt 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.
dSt 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
Question Has Been Solved by an Expert!
Get step-by-step solutions from verified subject matter experts
Step: 2 Unlock
Step: 3 Unlock
