随笔分类 -  算法初步

摘要:1 #include 2 #include 3 #include 4 #include 5 #include 6 using namespace std; 7 ifstream & open_file(ifstream & read, const string & file_name)... 阅读全文
posted @ 2014-05-16 18:03 搬砖程序员带你飞 阅读(410) 评论(0) 推荐(0)
摘要:下面为求取组合数的代码: 1 #include 2 #define MAX 10009 3 int prime[168]; 4 void print(int *v, int length) 5 { 6 int i = 0; 7 for (; i m - n; i--) {38 ... 阅读全文
posted @ 2014-05-01 22:59 搬砖程序员带你飞 阅读(307) 评论(0) 推荐(0)
摘要:简单堆排序 1 #include 2 #include 3 #include 4 #define Father(N) ((N - 1) >> 1) 5 #define Left(N) ((N 0) {39 int father = Father(N);40 ... 阅读全文
posted @ 2014-05-01 16:03 搬砖程序员带你飞 阅读(314) 评论(0) 推荐(0)
摘要:一个简单的快速排序实现。其中,对比的节点为第一个结点。 1 #include 2 #include 3 #include 4 #define VectorMax 100 5 using namespace std; 6 int vector[VectorMax]; /* * * sor... 阅读全文
posted @ 2014-05-01 13:04 搬砖程序员带你飞 阅读(311) 评论(0) 推荐(0)
摘要:从今天开始,准备着手写一些基础的算法,提高自己对基础知识的掌握能力。应包括如下内容:基本的排序算法快速排序算法堆排序算法shell 排序归并排序基本的图算法最短路径算法 (Dijkstra,Bellman-Ford,Floyd-Warshall)最小生成树Prim,Kruskal未完待续... 阅读全文
posted @ 2014-04-22 18:32 搬砖程序员带你飞 阅读(188) 评论(0) 推荐(0)