摘要: 单链队列-队列的链式存储结构:Code highlighting produced by Actipro CodeHighlighter (freeware)http://www.CodeHighlighter.com/-->typedefstructQNode{QElemTypedata;QNode*next;}*QueuePtr;structLinkQueue{QueuePtrfront,rear;//队头、队尾指针};链队列的基本操作(9个):voidInitQueue(LinkQueue&Q){//构造一个空队列Q。Q.front=Q.rear=(QueuePtr)mal 阅读全文
posted @ 2010-12-20 16:39 iwuyudong 阅读(9336) 评论(1) 推荐(0) 编辑
摘要: 栈的顺序存储结构:#defineSTACK_INIT_SIZE10//存储空间初始分配量#defineSTACK_INCREMENT2//存储空间分配增量structSqStack//顺序栈{SElemType*base;//在栈构造之前和销毁之后,base的值为NULLSElemType*top;//栈顶指针intstacksize;//当前已分配的存储空间,以元素为单位};顺序栈的基本操作(9个):voidInitStack(SqStack&S){//构造一个空栈S。S.base=(SElemType*)malloc(STACK_INIT_SIZE*sizeof(SElemType 阅读全文
posted @ 2010-12-20 16:31 iwuyudong 阅读(293) 评论(0) 推荐(0) 编辑
摘要: 线性表的双向链表存储结构:typedefstructDuLNode{ElemTypedata;DuLNode*prior,*next;}DuLNode,*DuLinkList;带头结点的双向循环链表的基本操作(14个):voidInitList(DuLinkList&L){//产生空的双向循环链表LL=(DuLinkList)malloc(sizeof(DuLNode));if(L)L->next=L->prior=L;elseexit(OVERFLOW);}voidClearList(DuLinkListL)//不改变L{//初始条件:L已存在。操作结果:将L重置为空表D 阅读全文
posted @ 2010-12-20 16:19 iwuyudong 阅读(229) 评论(0) 推荐(0) 编辑
摘要: 设立尾指针的单循环链表的12个基本操作:voidInitList(LinkList&L){//操作结果:构造一个空的线性表LL=(LinkList)malloc(sizeof(LNode));//产生头结点,并使L指向此头结点if(!L)//存储分配失败exit(OVERFLOW);L->next=L;//头结点的指针域指向头结点}voidClearList(LinkList&L)//改变L{//初始条件:线性表L已存在。操作结果:将L重置为空表LinkListp,q;L=L->next;//L指向头结点p=L->next;//p指向第1个结点while(p! 阅读全文
posted @ 2010-12-20 16:09 iwuyudong 阅读(250) 评论(0) 推荐(0) 编辑
摘要: 线性表的单链表存储结构:Code highlighting produced by Actipro CodeHighlighter (freeware)http://www.CodeHighlighter.com/-->structLNode{ElemTypedata;LNode*next;};typedefLNode*LinkList;//另一种定义LinkList的方法带有头结点的单链表的基本操作(12个)//包括算法2.8~2.10voidInitList(LinkList&L){//操作结果:构造一个空的线性表LL=(LinkList)malloc(sizeof(LNod 阅读全文
posted @ 2010-12-20 14:16 iwuyudong 阅读(1844) 评论(0) 推荐(1) 编辑
摘要: 线性表的动态分配顺序存储结构:Code highlighting produced by Actipro CodeHighlighter (freeware)http://www.CodeHighlighter.com/-->#defineLIST_INCREMENT2//线性表存储空间的分配增量structSqList{ElemType*elem;//存储空间基址intlength;//当前长度intlistsize;//当前分配的存储容量(以sizeof(ElemType)为单位)};顺序存储的线性表的基本操作(12个)Code highlighting produced by Ac 阅读全文
posted @ 2010-12-20 13:36 iwuyudong 阅读(544) 评论(0) 推荐(0) 编辑
摘要: Code highlighting produced by Actipro CodeHighlighter (freeware)http://www.CodeHighlighter.com/-->#include<string.h>//字符串函数头文件#include<ctype.h>//字符函数头文件#include<malloc.h>//malloc()等#include<limits.h>//INT_MAX等#include<stdio.h>//标准输入输出头文件,包括EOF(=^Z或F6),NULL等#include&l 阅读全文
posted @ 2010-12-20 11:42 iwuyudong 阅读(1119) 评论(0) 推荐(0) 编辑