2017年9月19日

计算几何 判断点在直线的左右哪一侧

摘要: 转载于博客:http://blog.sina.com.cn/s/blog_78ea87380101endw.html方法一:采用几何计算,求面积法。转载:http://blog.csdn.net/modiz/article/details/9928955注意向量是有方向的...判断 某一点在直线左右... 阅读全文

posted @ 2017-09-19 23:09 横济沧海 阅读(690) 评论(0) 推荐(0)

图论 迪杰斯特拉dijkstra求最短路径

摘要: 这个测试用的是下面这个图:9 160 1 2 3 4 5 6 7 80 1 10 2 51 2 31 4 51 3 72 4 12 5 73 4 23 6 34 6 94 5 34 7 95 7 56 7 26 8 77 8 4运行结果如下:#include#include#include#incl... 阅读全文

posted @ 2017-09-19 23:09 横济沧海 阅读(151) 评论(0) 推荐(0)

图论 用prim法求最小生成树

摘要: 我用的是邻接矩阵保存的图测试数据二所用的图如下:具体说明都在下面这段代码里(如果不嫌弃可以仔细阅读)#include#include#include#include#define inf 65535#includetypedef struct Graph{ int vertex[100]; ... 阅读全文

posted @ 2017-09-19 23:09 横济沧海 阅读(213) 评论(0) 推荐(0)

图论 邻接表广搜

摘要: 上一篇是邻接表dfs:点击打开链接所以bfs(&G,0)结果为0 2 1 3 4bfs(&G,1)结果为1 2 3 4bfs(&G,2)结果为2 3 4bfs(&G,3)结果为 3 4 bfs(&G,4)结果为4#include#include#include#include#includeusin... 阅读全文

posted @ 2017-09-19 23:09 横济沧海 阅读(210) 评论(0) 推荐(0)

图论 用广搜搜邻接矩阵

摘要: 用广搜搜邻接矩阵只是从某一点开始搜,如果是遍历全图的话就每个顶点挨个搜一遍#include#include#include#include#include#include#define inf 65535using namespace std;typedef struct mygraph{ i... 阅读全文

posted @ 2017-09-19 23:09 横济沧海 阅读(101) 评论(0) 推荐(0)

图论 邻接表建图+dfs

摘要: 上一篇用的是邻接矩阵建图:点击打开链接所以dfs(&G,0)结果为0 2 3 4 1dfs(&G,1)结果为1 2 3 4dfs(&G,2)结果为2 3 4dfs(&G,3)结果为 3 4 dfs(&G,4)结果为4#include#include#include#includeusing name... 阅读全文

posted @ 2017-09-19 23:09 横济沧海 阅读(187) 评论(0) 推荐(0)

图论 邻接矩阵建图+dfs遍历

摘要: 第一次i建图,用的邻接矩阵。#include#include#include#include#include#define inf 65535using namespace std;typedef struct mygraph{ int ver[1000]; int arc[100][1... 阅读全文

posted @ 2017-09-19 23:09 横济沧海 阅读(168) 评论(0) 推荐(0)

HDU 2141 二分查找

摘要: 还有http://blog.csdn.net/libin56842/article/details/17336981没做数据结构http://blog.csdn.net/olga_jing/article/details/50912239字典树Problem DescriptionGive you ... 阅读全文

posted @ 2017-09-19 23:09 横济沧海 阅读(154) 评论(0) 推荐(0)

二叉树知道前序和中序求后序,知道中序后序求中序

摘要: 今天来总结下二叉树前序、中序、后序遍历相互求法,即如果知道两个的遍历,如何求第三种遍历方法,比较笨的方法是画出来二叉树,然后根据各种遍历不同的特性来求,也可以编程求出,下面我们分别说明。首先,我们看看前序、中序、后序遍历的特性: 前序遍历: 1.访问根节点 2.前序遍历左子树 ... 阅读全文

posted @ 2017-09-19 23:09 横济沧海 阅读(1266) 评论(0) 推荐(1)

排序代码测试(未完成)

摘要: #include#includeusing namespace std;void swap(int &a,int &b){ int tmp=a; a=b; b=a;}void Selectsort(int a[],int n){ int i,j; for(i=0; ia... 阅读全文

posted @ 2017-09-19 23:09 横济沧海 阅读(124) 评论(0) 推荐(0)

导航