设带有头结点链栈,其栈项指针为top,向链栈中插入一个s结点时,则执行()
A: s->next=top->next; top->next=s
B: s->next=top->next; top=s
C: s->next=top; top->next=s
D: top->next=s; s->next=top->next
A: s->next=top->next; top->next=s
B: s->next=top->next; top=s
C: s->next=top; top->next=s
D: top->next=s; s->next=top->next
举一反三
- 已知带头结点的链栈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;
- 若不带头结点的链栈其栈顶指针为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,则插入一个s指针所指向的结点时,应进行如下()操作。 A: s->next=top; top=s; B: s->next=top->next; top->next=s; C: s->next=top; top->next=s; D: top>next = s;
- 向一个栈顶指针为top的链栈中插入一个x结点,则执行()。 A: top->next=x B: x->next=top->next,top->next=x C: x->next=top,top=x D: x->next=top,top=top->next