C程序设计第四Chap(链表)谭浩强分析.pptVIP

  • 2
  • 0
  • 约4.75千字
  • 约 23页
  • 2016-06-10 发布于湖北
  • 举报
单向链表的插入操作 例 struct student* insert(struct student* head,int number) { struct student *tmp=malloc(sizeof(struct student)); tmp-num = number; tmp-next = NULL; if (head==NULL) return head = tmp; tmp-next = head; head = tmp; return head; } 单向链表的插入操作 例 struct student* insert(struct student* head,struct student* ps) { struct student *p1=head,*p2; if (head==NULL) { head=ps; ps-next=NULL; } else { while (ps-num p1-num p1-next) { p2=p1;p1=p1-next; } if (ps-num = p1-num) { if (head==p1) head=ps; else p2-next=ps; ps-next=p1; } else { p1-ne

文档评论(0)

1亿VIP精品文档

相关文档