在线等,C语言的链表答案
来源:百度知道 编辑:UC知道 时间:2024/06/14 09:57:42
struct student
{ long num;
float score;
struct student *next;
};
struct student * insert(struct student *head, struct student *stud)
{ [4] ;
struct student *p1;
struct student *p2;
p1 = head;
p0 = stud;
if(head == NULL)
{
head = p0;
p0->next = NULL;
}
else
{
while ( [5] && (p1->next != NULL))
{ p2 = p1;
p1 = p1->next;
}
if(p0->num <= p1->num)
{ if (p1 == head)
{head = p0;
p0->next = p1;
}
else {p2->next = p0;
[6] ;
}}
else
{ p1->next = p0;
p0->next = NULL;
} }
return [7] ;
}
struct student *p0;// [4] ;
(p0->num > p1->num)// [5] ;
p0->next = p1; //[6] ;
head; //[7] ;
struct student
{ long num;
float score;
struct student *next;
};
struct student * insert(struct student *head, struct student *stud)
{
struct student *p0;// [4] ;
struct student *p1;
struct student *p2;
p1 = head;
p0 = stud;
if(head == NULL)
{
head = p0;
p0->next = NULL;
}
else
{
while ( (p0->num > p1->num) && (p1->next != NULL)) //[5]
{
p2 = p1;
p1 = p1->next;
}
if(p0->num <= p1->num)
{
if (p1 == head)
{
head = p0;
p0->next = p1;
}
else