2012年10月21日

排序和查找

摘要: //Function.hvoid bubble_sort(int Array[],int N);//冒泡排序void Quick_sqort(int Arr[],int begin,int end);//快速排序void selection_sort(int Array[],int N);//选择排序void heap_sort(int *array, int n);//堆排序void merge_sort(int Arr[],int begin,int end);//归并排序int binary_search(int Array[],int N,int num);//二分查找//Main.c 阅读全文

posted @ 2012-10-21 20:52 IThinktan 阅读(460) 评论(0) 推荐(0) 编辑

2012年10月20日

Floyd算法

摘要: 求每两个顶点之间的最短距离#include<iostream>using namespace std;#define N 100//最大顶点个数#define INF 32767 typedef struct//图的邻接矩阵类型{ int edges[N][N]; //邻接矩阵 int vexnum,arcnum; //顶点数,弧数 //int vexs[N];//存放顶点信息---如该顶点的下一个顶点} MGraph;void DispMG(MGraph g);//输出邻接矩阵void Floyd(MGraph g);//弗洛伊德算法---计算每对顶... 阅读全文

posted @ 2012-10-20 18:59 IThinktan 阅读(444) 评论(0) 推荐(0) 编辑

Dijkstra算法

摘要: 求顶点v0=0到其他各个点的最小距离#include<iostream>using namespace std;#define N 100//最大顶点个数#define INF 32767 typedef struct/*图的邻接矩阵类型*/{ int edges[N][N]; //邻接矩阵 int vexnum,arcnum; //顶点数,弧数 //int vexs[N];//存放顶点信息---如该顶点的下一个顶点} MGraph;void DispMG(MGraph g);//输出邻接矩阵void Dijkstra(MGraph g,int v0)... 阅读全文

posted @ 2012-10-20 18:10 IThinktan 阅读(379) 评论(0) 推荐(0) 编辑

2012年10月16日

TSP_遗传算法求解

摘要: head.h#define N 10class Generation{public: int state[4][N+1];//染色体---种群规模为4,有10个城市 float loadlength[4];//染色体的路径长度 float Fitness[4];//适应度 float SPro[4];//选择概率 float AcPro[4];//累积概率 int ChoiceNum[4];//选择次数 Generation() { int i; for(i=0;i<4;i++) for(in... 阅读全文

posted @ 2012-10-16 19:34 IThinktan 阅读(325) 评论(0) 推荐(0) 编辑

八数码问题_启发搜索

摘要: #include<stdio.h>#include<math.h>typedef struct { long parent; long index; int direction;//记录上一节点到当前节点空格移动方向 int Grid[9];//存储局面 int H;//启发函数值}State;State S,T;//起始态,目标态(目标态由评估函数决定好了)State OPEN[2048];//队列-----待考察的状态State CLOSE[2048];//--------考察过的状态int OPhead=0,OPtail=0,openlen=204... 阅读全文

posted @ 2012-10-16 19:23 IThinktan 阅读(367) 评论(0) 推荐(0) 编辑

2012年9月25日

AI_八数码

摘要: #includetypedef struct { int parent; int index; int Grid[9]; int H;//启发函数值}State;State S,T;//起始态,目标态State OPEN[2000];//队列-----考察已考察过的状态State CLOSE[2000];//--------存储待考察的状态int OPhead=0,OPtail=0,openlen=2000;int CLhead=0,CLtail=0,closelen=2000;void readdata();void init();int search();... 阅读全文

posted @ 2012-09-25 21:42 IThinktan 阅读(177) 评论(0) 推荐(0) 编辑

2012年7月26日

VC中应用Excel

摘要: http://www.cppblog.com/sleepwom/archive/2009/10/03/97804.html使用VS2010导出Excel:http://hfp0601.blog.163.com/blog/static/228483522011031104718762/ 阅读全文

posted @ 2012-07-26 15:35 IThinktan 阅读(162) 评论(0) 推荐(0) 编辑

Qt资源

摘要: Qt下载安装与配置: http://www.cnblogs.com/alwayzy/archive/2010/09/05/1818337.html官方:http://qt.nokia.com/resources-cncsdn :http://qt.csdn.netQt中文论坛http://www.qtcn.org 阅读全文

posted @ 2012-07-26 15:32 IThinktan 阅读(205) 评论(0) 推荐(0) 编辑

安装 MINGW GCC 4.4.0

摘要: MinGW 主页: http://www.mingw.org下载地址: http://sourceforge.net/projects/mingw/files/根据官方给出的 GCC 4.4.0 安装指南,需要下载以下文件:[MinGW 基础] GNU Binutils binutils-2.19.1-mingw32-bin.tar.gz MinGW Runtime mingwrt-3.16-mingw32-dev.tar.gz mingwrt-3.16-mingw32-dll.tar.gz MinGW API for MS-Windows w32api-3.13-mingw3... 阅读全文

posted @ 2012-07-26 14:30 IThinktan 阅读(1459) 评论(0) 推荐(0) 编辑

2012年7月22日

Qt的.pro文件

摘要: 在QT中,有一个工具qmake可以生成一个makefile文件,它是由.pro文件生成而来的,.pro文件的写法如下:1.注释从“#”开始,到这一行结束。2.模板模板变量告诉qmake为这个应用程序生成哪种makefile。下面是可供使用的选择:A> app -建立一个应用程序的makefile。这是默认值,所以如果模板没有被指定,这个将被使用。B> lib - 建立一个库的makefile。C> vcapp - 建立一个应用程序的VisualStudio项目文件。D> vclib - 建立一个库的VisualStudio项目文件。E> subdirs -这是一个 阅读全文

posted @ 2012-07-22 19:17 IThinktan 阅读(363) 评论(0) 推荐(0) 编辑

导航