设顺序栈S的栈顶指针为top,则元素a入栈的操作是( )。
A: S->top++; *S->top = e;
B: *S->top->top = e; S-top++;
C: *S->top = e;
D: S->top = e;
A: S->top++; *S->top = e;
B: *S->top->top = e; S-top++;
C: *S->top = e;
D: S->top = e;
举一反三
- 链栈S的栈顶指针为top,不能执行出栈操作的是() A: p=S->top;S->top=p->next; B: p=S->top;S->top=p; C: p=S;S->top=p->next; D: p=S->top;S->top=p->next->next;
- 若栈s中,规定初始栈顶指针s->top设为Maxsize,那么对栈s进行元素x的进栈操作,下述正确的是() A: s->top++; s->data[s->top]=x; B: s->data[s->top]=x; s->top++; C: s->top--; s->data[s->top]=x; D: s->data[s->top]=x; s->top--;
- 若不带头结点的链栈其栈顶指针为top,则删除栈顶元素,应进行如下()操作。 A: top=top->next; s=top;free(s); B: s=top; top=top->next; free(s); C: s=top->next; top->next=s->next;free(s); D: s=top; top->next=s->next;free(s);
- 已知带头结点的链栈top,则元素x对应的新结点s进栈操作的语句是() A: top->next=s;s->next=top->next; B: s->next=top->next;top->next=s; C: s->next=top;top=s; D: top=s;s->next=top;
- 已知带头结点的链栈top, 则元素x对应的新结点s进栈操作的语句是() A: s->next=top->next;top->next=s; B: top->next=s; s->next=top->next; C: s->next=top;top =s; D: top =s; s->next=top;