摘要: 转载请注明出处:http://blog.csdn.net/ns_code/article/details/19617187 图的存储结构 本文的重点在于图的深度优先搜索(DFS)和广度优先搜索(BFS),因此不再对图的基本概念做过多的介绍,但是要先大致了解下图的几种常见的存储结构。... 阅读全文
posted @ 2015-04-10 16:32 _tham 阅读(535) 评论(0) 推荐(0) 编辑
摘要: 【问题描述】 树是一种大家都不陌生的数据结构,它有可能是一颗空树或是一些满足要求的节点连接而成的有向边的集合。 一棵树只有一个根节点,根节点没有指向它的边。 除了根节点的每一个节点都只有一条边指向它。 出现环的图都不是树。 对一些节点连接而成的有向边的集合进行判定,判定每一组的输入数据构成的图是... 阅读全文
posted @ 2015-04-10 16:28 _tham 阅读(612) 评论(0) 推荐(0) 编辑
摘要: #include #include #include using namespace std; //表结点 typedef struct ArcNode{ int adjvex;//该弧所指向的顶点的位置 ArcNode *nextarc; }ArcN... 阅读全文
posted @ 2015-04-10 16:21 _tham 阅读(807) 评论(0) 推荐(0) 编辑
摘要: #include #include using namespace std; typedef struct MGraph{ string vexs[10];//顶点信息 int arcs[10][10];//邻接矩阵 int vexnum, arcnu... 阅读全文
posted @ 2015-04-10 16:18 _tham 阅读(307) 评论(0) 推荐(0) 编辑
摘要: #include #include #include using namespace std; #define INFINITY 65535//无边时的权值 #define MAX_VERTEX_NUM 10//最大顶点数 typedef struct MGraph{ ... 阅读全文
posted @ 2015-04-10 16:09 _tham 阅读(604) 评论(0) 推荐(0) 编辑
摘要: #include #include #include using namespace std; #define INFINITY 65535 #define MAX_VERTEX_NUM 10 typedef struct MGraph{ string vex... 阅读全文
posted @ 2015-04-10 15:59 _tham 阅读(638) 评论(0) 推荐(0) 编辑
摘要: #include using namespace std; template void Perm(T a[], int k, int m) { if(k==m) { for(int i=0; i<=m; i++) c... 阅读全文
posted @ 2015-04-10 15:44 _tham 阅读(291) 评论(0) 推荐(0) 编辑
摘要: #include #include #include #include #include #include using namespace std; typedef struct MGraph{ string vexs[10];//顶点向量 in... 阅读全文
posted @ 2015-04-10 15:35 _tham 阅读(255) 评论(0) 推荐(0) 编辑