
C数据结构
weijianstar
这个作者很懒,什么都没留下…
展开
-
循环队列【10】
/* 2011.09.06 循环队列的实现 */ #include #include using namespace std; #define MAXQSIZE 5 #define OK 1 #define ERROR 0 #defi原创 2011-09-06 23:10:26 · 494 阅读 · 0 评论 -
指针实现的栈(包含进制转换算法实现,括号匹配算法实现)【8】
由指针实现的栈,然后做一些小应用程序/* author:star Data:2011.04.23 由指针实现的栈,然后做一些小应用程序 */ #include #include #include #include using namespace std; typedef int ElemType; typedef int Status; #define ERROR 0; #define OVERFLOW 0; #define OK原创 2011-04-30 22:08:00 · 975 阅读 · 0 评论 -
动态数组实现的栈【7】
这是个数组实现的栈。优点在于可以随着栈中元素的增加调节数组的大小。在其中多理解指针吧。指针空间 的申请,指向。指针的运算。都可以在其中有所体会。/* author:Star Data:2011.04.20 一个动态数组实现的简单栈.帮助理解动态数组。 */ #include #include #include using namespace std; typedef int ElemType; typedef int Status; #define ERROR原创 2011-04-20 20:33:00 · 635 阅读 · 0 评论 -
单链表逆置【6】
<br /> <br />一个简单的单链表逆置程序<br />/* author:star Data:2011.04.11 一个简单的单链表逆置程序 */ #include<iostream> #include<stdio.h> #include<malloc.h> using namespace std; typedef char ElemType; typedef int Status; #define ERROR 0 #define OK原创 2011-04-11 22:48:00 · 734 阅读 · 0 评论 -
实际应用角度出发重新定义线性链表及其基本操作【5】
<br />里面有个MergeList()函数。算是最重要的一个函数了。也是最难的,由这个函数,调用了其他很多函数。<br /> <br />通过这个程序,也算是对程序的全局观有所把握吧。<br /> <br />用了很多指针。希望大家慢慢,静下来看吧。不然会被指针搞晕的。<br /> <br />第一次用C写这个超过300行的程序,调试还不错太费力。<br /> <br />不过总觉得,用C在各个模块化程序设计方面功力有些不足,需要指导。有相关书籍的希望推荐。<br /> <br /> <br />/*原创 2011-04-11 16:19:00 · 1137 阅读 · 2 评论 -
【C语言】malloc()和free()函数的讲解以及相关内存泄漏问题
<br />1、函数原型及说明:<br />void *malloc(long NumBytes):该函数分配了NumBytes个字节,并返回了指向这块内存的指针。如果分配失败,则返回一个空指针(NULL)。<br />关于分配失败的原因,应该有多种,比如说空间不足就是一种。<br />void free(void *FirstByte):该函数是将之前用malloc分配的空间还给程序或者是操作系统,也就是释放了这块内存,让它重新得到自由。<br /> <br />2、函数的用法:<br />其实这两个函数原创 2011-04-09 09:19:00 · 1233 阅读 · 0 评论 -
双循环链表『4』
带头结点的双循环链表程序/* author:star Data:2011.04.02 双循环链表程序 */ #include #include #include using namespace std; #define ERROR 0 #define OK 1 typedef int ElemType; typedef int Status; typedef struct DulNode { E原创 2011-04-03 00:02:00 · 1230 阅读 · 0 评论 -
静态链表的实现『2』
#include #include #include using namespace std; typedef int ElemType; #define MAXSIZE 100 typedef struct { ElemType data; int cur; }SLinkList[ MAXSIZE ]; void InitSpace_SL( SLinkList &space ) {//将一维数组space中各分量链成一个备用链表,space[0].cur为头指针,“0”表示原创 2011-03-13 22:39:00 · 443 阅读 · 0 评论 -
单链表(不含头结点)(1)
<br /> <br /> <br />只写了插入删除函数,还有一个create()函数,用来创建一个单链表。 大家主注意我的代码规范吧。<br /> <br />有什么建议。可以在人人网这篇帖子下发出。也可以注册优快云的帐号,贴出自己的代码进行比较。<br />#include<stdio.h> #include<malloc.h> typedef int ElemType; typedef int Status; #define TRUE 1 #define ERROR 0 #原创 2011-03-05 11:15:00 · 883 阅读 · 0 评论 -
链队列【9】
//2011年9月5日 // //队列的基本操作 #include #include #include using namespace std; typedef int QElemType; typedef int Status; #define O原创 2011-09-06 15:06:13 · 332 阅读 · 0 评论