数据结构期末复习:线性表与单链表操作实现.pdfVIP

  • 0
  • 0
  • 约4.58千字
  • 约 5页
  • 2026-08-07 发布于北京
  • 举报

数据结构期末复习:线性表与单链表操作实现.pdf

/*

数据结构期末不挂科课程

Ch2线性表

*/

#includealgorithm//forstd::min

#includecstdio

/*顺序表*/

//顺序表数据结构

#defineMAX_SIZE1000

typedefstructList{

int*elem;

intlength;

}List;

//初始化顺序表

ListCreate()

{ListL;

L.elem=newint[MAX_SIZE];

L.length=0;

returnL;

}

//顺序表

voidListInsert(ListL,inti,intval)

{if((i0)(iL.length))

return;

if(L.length==MAX_SIZE)

return;

for(intj=L.length;j=i+1;j--)L.elem[j]=L.elem[j-1];

L.elem[i]=val;

++L.length;

文档评论(0)

1亿VIP精品文档

相关文档