有说明语句:
Struct Node{ int data; Node * next; };
Node *head, *p,*q, *s;
并且,head是单向链表的头指针,p指向链表中的节点,q指向*p的前驱节点。
1.在*p之后插入节点*s的操作是( )。
(A)p->next=s; s->next=p->next; (B)s->next=p-next; p->next=s;
(C)p =s->next; s =p->next; (D)s =p->next; p =s->next;
2.在*p之前插入节点*s的操作是( )。
(A)q =s->next; s =p->next; (B)q->next=s; s->next=p;
(C)s=p->next; q=s->next; (D)s->next=p; q->next=s;
3.在*hear之前插入节点*s的操作是( )。
(A)s->next=head; head=s; (B)s->next=head->next; head->next=s;
(C)head=s; s->next=head; (D)head->next=s; s->next=head->next;
4.删除*p节点的操作是( )。
(A)q = p; delete p; (B)p = q; delete q;
(C)q->next=p->next; delete p; (D)p->next = q->next; delete q;
5.删除*(head->next)的操作是( )。
(A)p=head->next; head->next=head->next->next; delete p;
(B)head->next=head->next->next; p=head->next; delete p;
(C)p=head; head=head->next; delete p;
(D)head=head->next; p=head; delete p;