计算机软件技术02第二章 基本数据结构及其运算.pptVIP

  • 5
  • 0
  • 约1.45千字
  • 约 16页
  • 2020-09-12 发布于湖北
  • 举报

计算机软件技术02第二章 基本数据结构及其运算.ppt

第二章 作业 第二部分;struct node { char d; struct node *next; } int Lencst(head) struct node *head; { int n; struct node *p; n=0; p=head-next;;2.13(第153页) 设有一个循环链表,其结点值均为整数且按绝对值从小到大链接。试写出一个算法,将此循环连表中的结点按值从小到大链接。;步骤分析;//按值从小到大链接 void zhcj(node *head) { node *kk, *k, *j; if ((head-next)-next==head) //循环链表长度为1 return;;kk=head-next; k=kk-next; while (k!=head) { j=k-next; if (k-d0) //结点值为负,将该结点链接到链头 { k-next=head-next; head-next=k; kk-next=j; };kk=head-next; k=kk-next; while (k!=head) { j=k-next; //结点值为负,将该结点链接到链头 if (k-d0) { k-next=head-

文档评论(0)

1亿VIP精品文档

相关文档