2012年5月12日

队列的实现-链表

摘要: 声明:#include "stdio.h"#include "stdlib.h"typedef int DataType;struct Node;typedef struct Node *PNode;struct Node { DataType info; PNode link;};struct LinkQueue{ PNode f; PNode r;};typedef struct LinkQueue *PLinkQueue;//创建一个空队PLinkQueue createEmptyQueue_link(void){ PLinkQueue plqu; 阅读全文

posted @ 2012-05-12 22:56 yucong 阅读(369) 评论(0) 推荐(0)

队列的实现-顺序表

摘要: 声明:#include "stdio.h"#include "stdlib.h"typedef int DataType;//队头f指出实队头元素所的位置,队尾r指出实队尾元素所的位置的下一个位置struct SeqQueue { int MAXNUM; int f,r; DataType *q;};typedef struct SeqQueue * PSeqQueue;//创建一个空队PSeqQueue createEmptyQueue_seq(int m){ PSeqQueue paqu=(PSeqQueue)malloc(sizeof(struct 阅读全文

posted @ 2012-05-12 21:05 yucong 阅读(408) 评论(0) 推荐(0)

迷宫问题的解决-栈的应用

摘要: 声明和栈的声明一样:#include "stdio.h"#include "stdlib.h"typedef struct { int x,y,d;} DataType;struct SeqStack { int MAXNUM; //t<MAXNUM,指示栈顶位置,而不是元素个数; int t; DataType *s;};//顺序栈类型的指针类型typedef struct SeqStack * PSeqStack;//创建空栈PSeqStack createEmptyStack_seq(int m){ PSeqStack pStack=(PSe 阅读全文

posted @ 2012-05-12 12:51 yucong 阅读(471) 评论(0) 推荐(0)

导航