数据结构习题集.ppt
《数据结构习题集.ppt》由会员分享,可在线阅读,更多相关《数据结构习题集.ppt(54页珍藏版)》请在三一办公上搜索。
1、数据结构-复习,1,数据结构题集-2,P14:2.6、2.7P15:2.9P17:2.11、2.19,数据结构-复习,2,s-next=p-next;p-next=s;p-next-prior=s;s-prior=p;,p,s,插入元素算法2.8(a),在 P 所指向的结点后插入新结点,数据结构-复习,3,在 P 所指向的结点前插入新结点,插入元素算法2.8(b),s-prior=p-prior;p-prior-next=s;s-next=p;p-prior=s;,p,s,数据结构-复习,4,p-next=p-next-next;p-next-prior=p;,p,删除元素算法2.8(c),删
2、除结点P 的后继元素,数据结构-复习,5,p-prior-next=p-next;p-next-prior=p-prior;,p,删除元素算法2.8(e),删除结点P 指向的元素,数据结构-复习,6,2.11,Status Insert_SqList(SqList/Insert_SqList,数据结构-复习,7,2.19,Status Delete_Between(Linklist/Delete_Between,数据结构-复习,8,其它习题,P16:2.10 2.12P18:2.21 2.22 2.24 2.29 2.33,数据结构-复习,9,2.10,Status DeleteK(SqLis
3、t/DeleteK,数据结构-复习,10,2.12,int ListComp(SqList A,SqList B)/比较字符表A和B,并用返回值表示结果,值为1,表示AB;值为-1,表示AB.elemi?1:-1;if(A.length=B.length)return 0;return A.lengthB.length?1:-1;/当两个字符表可以互相比较的部分完全相同时,哪个较长,哪个就较大/ListComp,数据结构-复习,11,2.21,void reverse(SqList/reverse,数据结构-复习,12,2.22,void LinkList_reverse(Linklist/L
4、inkList_reverse,数据结构-复习,13,2.24,void reverse_merge(LinkList/构造新表头/reverse_merge,数据结构-复习,14,2.29,void SqList_Intersect_Delete(SqList/SqList_Intersect_Delete,数据结构-复习,15,2.30,void LinkList_Intersect_Delete(LinkList/else/while/LinkList_Intersect_Delete,数据结构-复习,16,2.33,Status LinkList_Divide(LinkList/完成循
5、环链表/LinkList_Divide,数据结构-复习,17,数据结构题集-3,P22:3.3P23:3.9 3.12P24:3.16P25:3.28,数据结构-复习,18,3.16,void Train_arrange(char*train)/这里用字符串train表示火车,H表示硬席,S表示软席p=train;q=train;InitStack(s);while(*p)if(*p=H)push(s,*p);/把H存入栈中else*(q+)=*p;/把S调到前部p+;while(!StackEmpty(s)pop(s,c);*(q+)=c;/把H接在后部/Train_arrange,数据结构
6、-复习,19,3.28,void InitCiQueue(CiQueue/InitCiQueue,数据结构-复习,20,void EnCiQueue(CiQueue/修改尾指针,3.28,数据结构-复习,21,Status DeCiQueue(CiQueue/DeCiQueue,3.28,数据结构-复习,22,P22:3.4P23:3.10 P24:3.13 3.15 3.17 3.19 3.21P26:3.30 3.31,其它习题,数据结构-复习,23,typedef struct Elemtype*base2;Elemtype*top2;BDStacktype;/双向栈类型 Status
7、Init_Stack(BDStacktype/Init_Stack,3.15,数据结构-复习,24,typedef struct Elemtype*base2;Elemtype*top2;BDStacktype;/双向栈类型 Status push(BDStacktype/push,3.15,数据结构-复习,25,typedef struct Elemtype*base2;Elemtype*top2;BDStacktype;/双向栈类型 Status pop(BDStacktype/pop,3.15,数据结构-复习,26,int IsReverse()InitStack(s);while(e=
8、getchar()!=/IsReverse,3.17,数据结构-复习,27,Status AllBrackets_Test(char*str)InitStack(s);for(p=str;*p;p+)if(*p=(|*p=|*p=)push(s,*p);else if(*p=)|*p=|*p=)if(StackEmpty(s)return ERROR;pop(s,c);if(*p=)/AllBrackets_Test,3.19,数据结构-复习,28,数据结构-复习,29,void NiBoLan(char*str,char*new)p=str;q=new;InitStack(s);/s为运算符
- 配套讲稿:
如PPT文件的首页显示word图标,表示该PPT已包含配套word讲稿。双击word图标可打开word文档。
- 特殊限制:
部分文档作品中含有的国旗、国徽等图片,仅作为作品整体效果示例展示,禁止商用。设计者仅对作品中独创性部分享有著作权。
- 关 键 词:
- 数据结构 习题集
![提示](https://www.31ppt.com/images/bang_tan.gif)
链接地址:https://www.31ppt.com/p-5355821.html