C++数据结构实例代码.docxVIP

  • 16
  • 0
  • 约1.12万字
  • 约 17页
  • 2022-08-13 发布于江苏
  • 举报
文档来源为:从网络收集整理.word版本可编辑.欢迎下载支持. 文档来源为:从网络收集整理.word版本可编辑.欢迎下载支持. PAGE PAGE 10 1 线性表的顺序表示#include iostream #include malloc.h using namespace std; typedef struct{ int *elem; int length; int listsize; }SqList; int Init_Sq(SqList L){ L.elem=(int *)malloc(100*sizeof(int)); if(!L.elem) exit(-2); L.length=0; L.listsize=100; return 1; } int ListInsert(SqList L,int i,int e){ if(i1||iL.length+1) return 0; if(L.length=L.listsize){ int *newbase=(int *)realloc(L.elem,(L.listsize+10)*sizeof(int)); if(!newbase) exit(-2); L.elem=newbase; L.listsize+=10; } int *q=(L.elem[i-1]); int *p=(L.elem[L.length-1]); f

您可能关注的文档

文档评论(0)

1亿VIP精品文档

相关文档