- 博客(11)
- 资源 (1)
- 收藏
- 关注
原创 Floyd(最短路径问题)
#include #include #include #define INF 0x7ffffff//如果设为0x7fffffff在执行算法时溢出。#define maxn 100using namespace std;int n;int edge[maxn][maxn];int a[maxn][maxn], path[maxn][maxn];void floyd() {
2012-12-31 14:20:46 942
原创 prim(最小生成树)
#include #include #include #define INF 0x7fffffff#define maxn 100using namespace std;int n, m;int edge[maxn][maxn];int lowcost[maxn];int nearvex[maxn];void prim(int u0) { int i, j;
2012-12-31 11:42:52 835
原创 二叉搜索树
#include #include #include #include #define maxn 1000#define T charusing namespace std;typedef struct btnode { T data; struct btnode *lchild; struct btnode *rchild;}btnode;btnode
2012-12-28 23:37:19 709
原创 二叉树
#include #include #include #include #include using namespace std;typedef struct node { char data; struct node *lchild; struct node *rchild;}btnode;typedef struct btree { stru
2012-12-28 23:28:59 713
原创 zoj 1586( prim)
#include #include #include using namespace std;int const maxn = 1000000;int map[1010][1010];int adapt[1010];int lowcost[1010];int t;int n;void init(){ scanf("%d", &n); for(int i = 0
2012-12-07 23:07:57 824 1
原创 POJ 1579
#include #include using namespace std;const int maxn = 55;int f[maxn][maxn][maxn];int w(int a, int b, int c) { if(a <= 0 || b <= 0 || c <= 0) { return 1; } if(a > 20 || b > 2
2012-12-05 23:43:03 1134 2
原创 二叉搜索树
#include #include #include #define maxn 1000#define T charusing namespace std;typedef struct btnode{ T data; struct btnode *lchild; struct btnode *rchild;}btnode;btnode *root = NUL
2012-12-04 22:02:49 818 1
原创 KMP算法
#include #include #include #include #define maxn 1000using namespace std;void getnext(char t[], int next[]){ memset(next, 0, sizeof(next)); int j = 0, k = -1; int len = strlen(t);
2012-12-02 23:15:55 823
原创 派生与私有保护
#include using namespace std;enum BREED{ black, red, white, blue};class mam{ public: mam(): age(4), weight(5){}; ~mam(){} int get_age()const { return age; } voi
2012-12-01 13:29:02 943
原创 构造函数与析构函数(C++)
#include using namespace std;enum BREED{ black, red, white, blue};class mam{ public: mam(); ~mam(); int get_age()const { return age; } void set_age(int age1) {a
2012-12-01 13:26:12 883 1
原创 隐藏基类的方法与调用
#include using namespace std;class mam{ public: void move() const {cout << "mammal move one step.\n"; } void move(int distance)const { cout << "mommal move";
2012-12-01 13:24:52 1304
空空如也
TA创建的收藏夹 TA关注的收藏夹
TA关注的人