Z
zmj71
Unregistered / Unconfirmed
GUEST, unregistred user!
设栈S={1,2,3,4,5,6,7},其中7为栈顶元素,请写出下列函数的输出结果。
#define Max 7
void algo(int s[],int top)
{int i=0,top1=0,f=0,r=0;
int q[Max],t[Max]
while(top>0)
if ((i=1-i)!=0
t[top1++]=s[--top];
else
q[r++]=s[--top];
while (f<r)
s[top++]=q[f==};
while(top1>0)
s[top++]=t[--top1];
printf("/n");
while(top>0)
printf("%d,",s[s[--top]);
}
#define Max 7
void algo(int s[],int top)
{int i=0,top1=0,f=0,r=0;
int q[Max],t[Max]
while(top>0)
if ((i=1-i)!=0
t[top1++]=s[--top];
else
q[r++]=s[--top];
while (f<r)
s[top++]=q[f==};
while(top1>0)
s[top++]=t[--top1];
printf("/n");
while(top>0)
printf("%d,",s[s[--top]);
}