data.place<<""; current=current->nlink;?}?cout<fi" /> data.place<<""; current=current->nlink;?}?cout<fi" />

全文预览

数据结构线性表存储实验报告

上传者:业精于勤 |  格式:doc  |  页数:21 |  大小:570KB

文档介绍
nt=L->first;?cout<<"";?while(current)?{ cout<<current->data.place<<""; current=current->nlink;?}?cout<<endl;}//返回双向链表L中数据元素结点数intLengthDoubleChainList(DoubleChainList&L){?DoubleChainNode*current=L->first;?intlength=0;?while(current)?{ length++; current=current->nlink;?}?returnlength;}//删除双向链表L中所有数据结点,并释放结点空间voidDestroyDoubleChainList(DoubleChainList&L){?DoubleChainNode?*current;?current=L->first;?while(L->first)?{ current=current->nlink; deleteL->first; L->first=current;?}}//将L中第k个元素取至x中带出,如不存在返回false,找到返回true;boolGetElemDoubleChainList(DoubleChainList&L,intk,EType&result){?if(k<1)?return?false;?DoubleChainNode *current;?current=L->first;?int?index=1;?while(index<k&&current)?{ current=current->nlink; index++;?}?if(current)?{ result=current->data; returntrue;?}?returnfalse; //k值太大,不存在第k个结点}

收藏

分享

举报
下载此文档