- 博客(39)
- 资源 (4)
- 收藏
- 关注
原创 Yes!~ 我又写了一次树的建立及中序递归遍历。学习是一个不断重复的过程。温故而知新呀!~还是我自己调试出来的,找出错误的感觉真好!~
//树#include#includeusing namespace std;#define MAX 100typedef struct bnode{ char data; struct bnode *left,*right;}btree;void createTree(btree *&b,string s){ int j=0; ch
2010-04-28 13:27:00 717
原创 终于会写makefile 了。晒一个gtk连接数据库的登录窗口程序
cone.h: //gcc -g -Wall -o login login.c -I/usr/include/mysql -L/usr/lib/mysql -lmysqlclient `pkg-config --cflags --libs gtk+-2.0`#include#include#define MYSQL_PORT 3306MYSQL *myconnect
2010-04-28 11:59:00 3145
原创 想了两天,终于把堆排序搞懂了。
//堆排序#include#define MAX 100using namespace std;void display(int a[],int n);void silt(int a[],int n,int m){ int t; t=a[m]; int j=2*(m+1)-1; // display(a,n); while(j {
2010-04-27 09:15:00 652
原创 今天用GTK写的一个界面,挺简单的。算是我的入门之作吧。
#includestatic GtkWidget *credits_window;GtkWidget *create_credits (){ GtkWidget *window; GtkWidget *vbox,*hbox; GtkWidget *notebook,*button; GtkWidget *page,*viewport; GtkWidget
2010-04-25 22:37:00 1594
原创 花了好长一段时间,终于把快速排序法弄懂了。
//快速排序法#includeusing namespace std;void split(int a[],int low,int high,int &i){//a[]为2 8 3 6 9 5 1 4 0 7 i=low; int j=high; int x=a[i]; while(i {//目标:x=2, a[]=2 8 3 6 9 5
2010-04-24 10:44:00 551
转载 算法目录
1.图论2.数据结构3.搜索4.动态规划5.模拟6.数学7.计算几何8.博弈论9.字符串=========================================初期:一.基本算法:(1)枚举. (poj1753,poj2965)(2)贪心(poj1328,poj2109,poj2586)(3)递归和分治法.(4)递推.(5)
2010-04-23 12:08:00 998
原创 今晚试验了好久,略有小成,可是还是不够理想。。没把数据库中的具体内容显示出来,只有那个表头。
//先不管数据库,先做好界面。//连接数据库并显示#include#includeMYSQL *myconnect=NULL;gboolean isclosed=TRUE;MYSQL_RES *res;MYSQL_FIELD *fd;MYSQL_ROW row;static GtkWidget *mlabel;static GtkWidget *te
2010-04-22 22:48:00 719
原创 还不能成功,暂还不知道为什么会这样错的。
//还是未能成功#include#include//#include#includeusing namespace std; char book[105]; int count=0;int input(int &count){ ifstream cin("g.in"); int m,n; cin>>m>>n; string cmd;
2010-04-22 22:47:00 476
原创 终于学会了用sort排序结构体了。
//I did it!!#include#include#include#define maxSize 1020using namespace std;struct node{ double sum; string s;};int m,n;node array[maxSize];bool cmp(const node &a,co
2010-04-22 22:37:00 4690
转载 STL 中sort、qsort 的用法
STL中sort函数用法简介 做ACM题的时候,排序是一种经常要用到的操作。如果每次都自己写个冒泡之类的O(n^2)排序,不但程序容易超时,而且浪费宝贵的比赛时间,还很有可能写错。STL里面有个sort函数,可以直接对数组排序,复杂度为n
2010-04-21 12:59:00 12747 2
原创 图的操作,没做出来,WA呀,遗憾~~
1157.寻找一星龙珠 Time Limit: 1000 MS Memory Limit: 65536 K Total Submissions: 192 (65 users) Accepted: 46 (45 users) Description
2010-04-20 22:58:00 975
原创 上星期天做的,没有做出来,郁闷呀
//第二次网络预赛/*6 3radish 1 10 15rose 1 18 23watermelon 2 28 13 23grapefruit 3 61 26 39pitaya 4 70 29 41blueberry 5 31 14 18*/#include#include#include#include#includeusing nam
2010-04-20 22:57:00 384
原创 模仿别人的程序
//网络第一次预赛。参考后的結果/*#include#include#define MAX 1010using namespace std;struct node{ double sum; string s;};node array[1010]; int n,m;void input(int &n,int &m){ ifstre
2010-04-20 22:56:00 561
原创 嵌入式linux参考资料
嵌入式Linux开发需要的参考资料作者: 来源于: 发布时间:2008-10-6 20:45:00 引导:如需获得对 vmlinux 和 zimage 之间区别的极好解释,请在 Alessandro Rubini 编写的“Kernel Configuration: dealing
2010-04-18 21:52:00 530
原创 今天做了几个题大赛的
//第四章/*//Quicksum#include#includeusing namespace std;int main(){ ifstream cin("4-1.in"); char c[256]; int n=0; int sum=0; while(cin.getline(c,256)) {
2010-04-17 23:14:00 457
原创 今天对于图又有了更深的理解,可是还是有问题,那个非递归的深度优先不知道怎么的,好像不能够完全遍历。有点郁闷呀。
//深度优先和广度优先#include#include#define Vnum 20using namespace std;typedef struct arcnode{ int adjvex; struct arcnode *nextarc;}arcnode;typedef struct vexnode{ int vervex; arc
2010-04-17 23:12:00 599
原创 郁闷了一段之后,真高兴,把图的创建理解了。keke~
/*//图#include#include#define Vnum 20using namespace std;typedef struct arcnode{ int adjvex; //结点的编号 struct arcnode *nextarc;//指向下一结点的指针}arcnode;typedef struct vexnode{ i
2010-04-15 11:25:00 484
原创 终于用horspool算法把题目做出来了,可惜那个系统却说超时了,真想不能,有这么好的算法,还超时。
//最贵的贝壳#include#include#include#define MAXN 1020#define MAXM 120using namespace std;typedef struct{ int data[MAXN]; char cs[MAXN];}cost;int *b_table(char pat[],int p_size)
2010-04-14 21:51:00 568
原创 horspool 字符串模式匹配。做了一个晚上,还是没有把题解出来,快关灯了,真糟!
//最贵的贝壳#include#include#include#define MAXN 1020#define MAXM 120using namespace std;typedef struct{ int data[MAXN]; char cs[MAXN];}cost;int *b_table(char pat[],int p_size)
2010-04-13 22:51:00 388
原创 我写的回溯法,出现了一个BUG,找了好久。。。。才对上。。。
最終的結果是输入完所有的情况后,没有退出程序。。。/*//回溯法#define N 100#define M 100#includeint com_back(int m,int n){ int a[N]; int i=0; a[i]=1;do { if(a[i]-i
2010-04-13 22:49:00 282
原创 我写的回溯法,出现了一个BUG,找了好久。。。。才对上。。。
最終的結果是输入完所有的情况后,没有退出程序。。。/*//回溯法#define N 100#define M 100#includeint com_back(int m,int n){ int a[N]; int i=0; a[i]=1;do { if(a[i]-i { if(i==n-1)
2010-04-11 22:51:00 435
原创 今天才从实践中知道,原来C里面是没有引用的,只有C++才有。
//练习引用//#include//#include#include//using namespace std;void rr(int &a,int &b){ int t=0; t=a; a=b; b=t; return ;}int main(){ int m=1; int n=2; printf("%d
2010-04-11 22:49:00 1069 1
原创 今天下午写的,真耗时间啊,要自己写程序都不容易,功底不够厚啊!
/*#include//#include//#include//#includeusing namespace std;int a[5010],b[5010],c[5000];int main(){ //ifstream cin("aa.in"); int j=0,k=0; int n; cin>>n; int i,maxi=0;
2010-04-10 19:36:00 890
转载 字符串匹配算法比较
做了一个很粗糙的实验,比较了几种字符串匹配算法的性能。程序用-O3进行编译优化。以下为待查找的文本长度为434018字节,模式串长度为4时的典型实验结果。可以看到,horspool算法最快,表现最差的为KMP系的shift_and算法(实验结果与《柔性字符串匹配》一书中的结果一致)。strstr(C库函数) time:743 微秒horspool: time:642 微秒s
2010-04-10 19:35:00 636
原创 今天早上写的二叉树的建立及遍历
//树的操作#include#include#include#define MAXN 100using namespace std;typedef struct node{ char data; struct node *left,*right;}BTree;int create_tree(BTree *&b,string str){
2010-04-09 21:43:00 395
转载 给IT新人的建议
IT新人最实用的职场建议 发布时间:2009-6-24作者:中国IT实验室阅读量:7127职场新人,尤其是IT新人,一旦社会角色从学业转为职业,那么新的人生便波澜壮阔的展开了,只是,是否每个人都会有足够的聪慧和细心? 1.作
2010-04-09 21:41:00 487
原创 C++STL练习
//ACM程序设计/*//vector向量容器#includeusing namespace std;int main(){ vectorv; v.push_back(2); v.push_back(7); v.push_back(9); return 0;}*//*
2010-04-09 21:38:00 762
原创 C++STL 中向量和字符串的操作,真累呀,一个晚上都在干体力活
//ACM程序设计/*//vector向量容器#includeusing namespace std;int main(){ vectorv; v.push_back(2); v.push_back(7); v.push_back(9); return 0;}*//*//用迭代器访问vector元素#include#
2010-04-08 21:42:00 1120
原创 //顺序查找算法
//顺序查找算法#define LIST_SIZE 20#includetypedef struct { int key;}RecordType;typedef struct { RecordType r[LIST_SIZE+1];//r[0]为工作单元 int length;}Recor
2010-04-08 21:41:00 505
原创 顺序查找算法,好开心哦,又懂了一点
//顺序查找算法#define LIST_SIZE 20#includetypedef struct { int key;}RecordType;typedef struct { RecordType r[LIST_SIZE+1];//r[0]为工作单元 int length;}RecordList;int sep_search( Re
2010-04-08 13:10:00 514
原创 回溯法
/*#includeint comb_back(int n,int r){ int *a=new int[r]; int i=0; int a[i]=1; int count=0; while(a[i]-i { if(i==r-1) { for(int j=0;j {
2010-04-07 22:52:00 374
原创 堆栈及其模拟
#includeint queue[100];int main(){ int i; int n,front,rear; scanf("%d",&n); for(i=0;i { queue[i]=i+1; } front=0; rear=n; while(front { printf(
2010-04-07 22:51:00 408
原创 字符串排序和查找
#include#include#include int n;char word[2000][10],sorted[2000][10];int cmp_char(const void* _a,const void* _b){ char *a=(char *)_a; char *b=(char *)_b; return *a-*b;}int cmp_
2010-04-06 18:03:00 561
原创 动态规划问题
#includeint main(){ float a[5][5]; int i=0,j=0; for(i=0;i { a[i][4]=4.0+i; a[4][i]=4.0+i; } for(j=0;j { for(i=0;i { printf("%.
2010-04-06 18:01:00 383
原创 6174问题
#include int get_text(int x) { int a,b; char s[10],t; sprintf(s,"%d",x);//ת»»Îª×Ö·ûŽ® int len=sizeof(x); for(int i=0;i { for(int j=0;j { if(s[j]
2010-04-05 22:58:00 1045
原创 //计算n=1000的阶乘。
/*//计算n=1000的阶乘。 #include#include#define MAXN 3000int a[MAXN];int main(){ int i,j,n; int s=0; scanf("%d",&n); memset(a,0,sizeof(a)); a[0]=1; for(i=2;i {
2010-04-05 22:11:00 661
原创 算法竞赛入门经典
/*#includeint main(){ int a,b,c; int t; scanf("%d%d%d",&a,&b,&c); if(a>=b) { t=a; a=b; b=t; } if(a>=c) { t
2010-04-05 21:59:00 583
原创 算法竞赛入门经典
/*#includeint main(){ int a,b,c; int t; scanf("%d%d%d",&a,&b,&c); if(a>=b) { t=a; a=b; b=t; } if(a>=c) { t=a; a=c; c=t;
2010-04-03 00:05:00 805
C语言教程 有100个例子 一共十章 有语法的介绍 还有例子 提供源代码 可在电脑上直接运行 很好很强大!~~
2009-10-22
空空如也
TA创建的收藏夹 TA关注的收藏夹
TA关注的人