数据结构题目:双链表中,在*p结点之后插入一个结点*s的操作是?

2024-12-22 17:08:45
推荐回答(3个)
回答1:

B D都正确。。。
我验证过的。。你可以试试
#include
using namespace std;

struct list
{
int data;
list *prior;
list *next;
};
int main()
{
list *p, *s, *q;
p = new list;
q = new list;
s = new list;
p->data = 1;
s->data = 2;
q->data = 3;

p->next = q;
q->prior = p;
p->next->prior=s;s->next=p->next;s->prior=p;p->next=s;

cout << p->data << endl;
cout << p->next->data << endl;
cout << p->next->next->data;
}

回答2:

B D都正确。。。

回答3:

1223