标签:
单链表删除节点
node *del(node *head, int num)
{}
单链表插入节点
node *insert(node* head, int num)
{
node *p0, *p1, *p2;
p1 = head;
p0 = (node *)malloc(sizeof(node));
p0->data = num;
while (p0->data > p1->data && p1->next != NULL)
{
p2 = p1;
p1 = p1->next;
}
if (p0->data <= p1->data)
{
if (head == p1)
{
p0->next = p1;
head = p0;
}
else
{
p2->next = p0;
p0->next = p1;
}
}
else
{
p1->next = p0;
p0->next = NULL;
}
return (head);
}
版权声明:本文为博主原创文章,未经博主允许不得转载。
标签:
原文地址:http://blog.csdn.net/wangfengfan1/article/details/47175697