- 博客(12)
- 资源 (2)
- 收藏
- 关注
原创 循环队列【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
492
原创 链队列【9】
//2011年9月5日 // //队列的基本操作 #include #include #include using namespace std; typedef int QElemType; typedef int Status; #define O
2011-09-06 15:06:13
330
原创 判断一个数是否为2的整数次幂
<br />public class Main{ public static void main(String[] args) { for(int i=2;i<1000;i++){ if((i&(i-1))==0){ System.out.println(i); } } } }
2011-05-07 23:15:00
587
1
原创 指针实现的栈(包含进制转换算法实现,括号匹配算法实现)【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
973
原创 动态数组实现的栈【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
631
原创 单链表逆置【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
733
原创 实际应用角度出发重新定义线性链表及其基本操作【5】
<br />里面有个MergeList()函数。算是最重要的一个函数了。也是最难的,由这个函数,调用了其他很多函数。<br /> <br />通过这个程序,也算是对程序的全局观有所把握吧。<br /> <br />用了很多指针。希望大家慢慢,静下来看吧。不然会被指针搞晕的。<br /> <br />第一次用C写这个超过300行的程序,调试还不错太费力。<br /> <br />不过总觉得,用C在各个模块化程序设计方面功力有些不足,需要指导。有相关书籍的希望推荐。<br /> <br /> <br />/*
2011-04-11 16:19:00
1134
原创 【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
1232
原创 双循环链表『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
1228
原创 单循环链表(头指针指在头结点)『3』
为了便于学习单循环链表。没有写那么多函数。只写了一个插入函数。便于理解,这种情况下是,只有一个空的头结点,然后插入一个节点,既是在头部插入节点,也是在尾部插入节点。其他情况比这个情况都易于理解。所以只要会这一个,其他就都会了。这个单循环链表(头指针指在头结点)。强调:数据结构不是为了会写程序,只是利用程序设计语言来掌握一种思想。//单循环链表 Year:2011 Month:Three data: 24 #include #include #include using namespace s
2011-03-24 23:00:00
2423
原创 静态链表的实现『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
442
原创 单链表(不含头结点)(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
882
空空如也
TA创建的收藏夹 TA关注的收藏夹
TA关注的人