全文预览

顺序表的应用-数据结构实验报告

上传者:徐小白 |  格式:docx  |  页数:15 |  大小:80KB

文档介绍
(SqList*L,ElemTypee){if(!(*L).elem)returnERROR;(*L).elem[(*L).length++]=e;returnOK;}StatusListInsert(SqList*L,inti,ElemTypee){intcount;if(i<1||i>(*L).length+1)returnOVERFLOW;if((*L).length==(*L).MaxSize)(*L).elem=(ElemType*)realloc((*L).elem,sizeof(ElemType)*((*L).MaxSize+LISTINCREMENT));if(!(*L).elem)exit(OVERFLOW);for(count=(*L).length-1;count>=i-1;count--)(*L).elem[count+1]=(*L).elem[count];(*L).elem[i-1]=e;(*L).length++;returnOK;}StatusListDelete(SqList*L,inti){intcount;if(i<1||i>(*L).length+1)returnOVERFLOW;for(count=i;count<(*L).length;count++)(*L).elem[count-1]=(*L).elem[count];(*L).length--;returnOK;}StatusLocateElem(SqListL,ElemTypee){intcount;for(count=0;count<L.length;count++)if(strcmp(L.elem[count].name,e.name)==0)break;if(count<L.length){printf("学号姓名成绩\n");Pri(L.elem[count]);}

收藏

分享

举报
下载此文档