1) /*求顺序表L中第一个值等于x的结点的序号,无值为x的元素时结果为0*/
int xlocate(List L,ListItem x)
{
int i=0;
while( ① && ② ) {i++;}
if ( i<L->n ) return( ③ );
else return(0);
}
2) /*栈的逆置,栈内元素类型为整型*/
void algo(Stack S)
{ int i, n=0, A[50];
while(!StackEmpty(S))
{
④
n++;}
for (i =0;i<n;i++ ) ⑤
}
备注:如栈S从栈底到栈顶的元素依次为a,b,c,d;逆置后则变为d,c,b,a。