- 博客(27)
- 资源 (2)
- 收藏
- 关注
转载 #pragma指令
http://hi.baidu.com/ciw%5Fblue/blog/item/c17461f4f69efce97709d774.html原帖地址 在所有的预处理指令中,#Pragma 指令可能是最复杂的了,它的作用是设定编译器的状态或者是指示编译器完成一些特定的动作。#pragma指令对每个编译器给出了一个方法,在保持与C和C ++语言完全兼容的情况下,给出主机或操作系统专有的特
2009-04-05 17:48:00 802
原创 赫夫曼编码课设
TC下编译。。 先扫描文件下出现字符的各个概率,动态建立赫夫曼树,作图。。。操作都在文件下处理。。 #include "stdio.h"#include "malloc.h"#include "string.h"#include "stdlib.h"#include "graphics.h"#define OK 1 #define ERROR 0 #def
2009-01-18 11:59:00 835
转载 关于位运算
原帖地址http://hi.baidu.com/alpc43/blog/item/3cdbf054a8b18752574e0006.html DescriptionBackground Today, there are quite a few cars, motorcycles, trucks and other vehicles out there on the streets t
2008-12-10 17:04:00 695
原创 各种排序算法
#include #include #include using namespace std;void Swap(int &a,int &b){ int t=a; a=b; b=t;}void Output(int *a,int n){ for(int i=0;i cout" "; co
2008-12-10 16:12:00 1020
原创 最短路径
Dijkstra 单源最短路 #include #include #include using namespace std;#define OVERFLOW -1 #define INFINITY 10000 typedef char VertexType;typedef int* PIter; typedef string* PathM
2008-12-07 18:13:00 577
原创 拓扑排序关键路径
输入数据,输出拓扑排序,关键路径(如果有多组解,分情况输出),一直都是尽量不用STL的,不过有写时候不用确实很麻烦。。 输入9 11a b c d e f g h ia b 6a c 4a d 5b e 1c e 1d f 2e g 9e h 7f h 4g i 2h i 4输出a b c e g d f h iCase #1:a b e h i Case #2:a b
2008-12-07 00:17:00 795
原创 关节点
#include #include using namespace std;#define OK 1 #define OVERFLOW -2 typedef int Status;typedef char VertexType;typedef enum{DG,DN,UDG,UDM} GraphKind;typedef struct ArcN
2008-12-07 00:15:00 724
原创 最小生成树
prim算法 #include #include using namespace std;#define OK 1 #define OVERFLOW -2 #define MAX 1000 typedef int Status;typedef char VertexType;typedef int* Inpoint;typedef int
2008-11-16 00:40:00 642
原创 深度和广度优先搜索
#include #include #include using namespace std;#define OK 1 #define OVERFLOW -2 typedef int Status;typedef char VertexType;typedef enum{DG,DN,UDG,UDM} GraphKind;typedef str
2008-11-08 00:27:00 639
原创 全排列
n排列,按字典顺序输出所以可能例如输入3输出1 2 31 3 22 1 32 3 13 1 23 2 1 非递归#include #include using namespace std;void F(int n){ int i,j,k,*p=new int[n]; for(i=0;i p[i]=i+1
2008-11-06 23:43:00 527
原创 二叉树的几种非递归建立与遍历的实现
#include #include #include #include #include using namespace std;#define OK 1 #define ERROR 0 #define OVERFLOW -2 typedef int Status;typedef char ElemType;typedef Status (*
2008-10-30 00:25:00 1280
原创 huffman编码
#include #include #include using namespace std;#define MAX 1000 typedef char ElemType;typedef int PerType;typedef struct Elem{ ElemType data; PerType percent;
2008-10-29 20:37:00 669
原创 矩阵(十字链表)
就做了创建,加法还有输出,减法与加法类似`` #include #include using namespace std;#define OK 1 #define ERROR 0 #define OVERFLOW -2 typedef int Status;typedef struct OLNode{ int i,j;
2008-10-19 02:55:00 822
原创 词索引表
STL实现,好久没看STL了,做个当温习一下,也是自己怕书上的算法麻烦偷懒下哈 BookInfo.txt文件 005 Computer Data Structures 010 Introduction to Data Structures 023 Fundamentals of Data Structures 034 The Design and Analysis of Compu
2008-10-18 20:40:00 968 1
原创 稀疏矩阵运算
行逻辑链接的三元组顺序表实现,加减乘和转置运算,调的好累,这两天少了点劲头了,坚持住,试了好几组数据应该没问题了,但也可能还有漏洞``` #include #include #include using namespace std;#define OK 1 #define ERROR 0 #define OVERFLOW -2 typed
2008-10-18 02:02:00 987
原创 KMP模式匹配
自己的机子上用DEVC尽然出现异常在别人机子上没事,郁闷死,弄了超久才弄出来,汗,有空一会出个解题报告 #include #include #include #include using namespace std;int *nextval;void get_nextval(string s,int *next){ next[0]=-1
2008-10-14 20:07:00 552
原创 循环队列
#include #include #include using namespace std; #define OK 1 #define ERROR 0 #define OVERFLOW -2 #define MAXSIZE 10 typedef int QElemType; typedef int Status;typedef str
2008-10-12 22:58:00 519
原创 链式队列
还是打算写一写吧 #include #include #include using namespace std;#define OK 1 #define ERROR 0 #define OVERFLOW -2 typedef int Status;typedef int QElemType; typedef struct QNode{
2008-10-12 22:30:00 517
原创 表达式求值
写了大半夜终于写完了 整理算法如下:——遇运算对象,直接压入OPND ——遇运算符op,与OPTR 栈顶op比较。op 优先级不低于op 时弹出op ,从OPDN 弹出运算对象,计算结果压入OPDN。反复至栈顶运算符优先级低于op 时将运算符op 压入OPTR ——遇左括号,直接进栈OPTR ——遇右括号,逐个弹出运算符,从OPDN 弹出运算对象,计算并将结果压
2008-10-12 03:52:00 604
原创 迷宫(栈实现)
#include #include #include using namespace std;#define OK 1 #define ERROR 0 #define STACK_INIT_SIZE 100 #define STACKINCREMENT 10 #define OVERFLOW -2 typedef int Status;t
2008-10-11 03:15:00 871
原创 进制转换(十进制转n进制)
#include #include #include using namespace std;#define OK 1 #define ERROR 0 #define STACK_INIT_SIZE 100 #define STACKINCREMENT 10 #define OVERFLOW -2 typedef int Status;typede
2008-10-10 03:00:00 745
原创 一元多项式运算
#include #include #include using namespace std;#define OK 1 #define ERROR 0 #define OVERFLOW -2 typedef struct polyn{ float coef; int expn; struct poly
2008-10-10 02:38:00 801
原创 双向循环链表
#include #include #include #include #include using namespace std;#define OK 1 #define ERROR 0 #define OVERFLOW -2 typedef int Status;typedef int ElemType; typedef struct D
2008-10-08 02:05:00 569
原创 循环链表实现约瑟夫环
已知n个人(以编号1,2,3...n分别表示)围坐在一张圆桌周围。从编号为k的人开始报数,数到m的那个人出列;他的下一个人又从1开始报数,数到m的那个人又出列;依此规律重复下去,直到圆桌周围的人全部出列。 #include #include #include using namespace std;#define OK 1 #define ERROR 0
2008-10-07 19:44:00 621
原创 静态链表
#include #include #include using namespace std;#define OK 1 #define ERROR 0 #define OVERFLOW -2 #define MAXSIZE 10 typedef int Status;typedef int ElemType;typedef
2008-10-07 19:40:00 699
原创 单链表
#include #include #include using namespace std;#define OK 1 #define ERROR 0 typedef int Status;typedef int ElemType; typedef Status(*compare)(ElemType,ElemType);typedef s
2008-10-07 19:37:00 614
原创 顺序表
#include #include #include using namespace std;#define OK 1 #define ERROR 0 #define OVERFLOW -2 #define LIST_INIT_SIZE 10 #define LISTINCREMENT 10 typedef int Status;ty
2008-10-07 19:32:00 645
空空如也
TA创建的收藏夹 TA关注的收藏夹
TA关注的人