厚德载物peng.blog.chinaunix.net
chengxiaopeng
hello world.
全部博文(308)
汇编语言(0)
离散数学(1)
C语言趣味程序百(11)
C++程序设计(30)
串(1)
队列(2)
栈(2)
链式存储结构(1)
线性表(1)
Shell编程(4)
其它(13)
Linux环境下C编程(3)
网络编程(1)
贪心算法(1)
分治法(1)
穷举法(1)
算法练习(1)
妙趣横生的算法(57)
xiongwen
jys715
li117666
lijunlin
km康蒙92
zhaounix
59459763
yaogh
youlan87
分类: C/C++
2010-08-27 14:43:24
struct student *insert(struct student *head,struct student *stu){ struct student *p0,*p1,*p2; p1 = head; p0 = stu; if(NULL == head) { head = p0; p0->next = NULL; } else { while (p0->num > p1->num && p1->next != NULL) { p2 = p1; p1 = p1->next; } if (p0->num <= p1->num) { if (p1 == head) { head = p0; } else { p2->next = p0; } p0->next = p1; } else { p1->next = p0; p0->next = NULL; } } n += 1; return head;}
上一篇:C程序设计-链表元素删除[11.2]
下一篇:C程序习题-编写new函数[11.6]
登录 注册