普里姆算法(Prim算法),图论中的一种算法,可在加权连通图里搜索最小生成树。意即由此算法搜索到的边子集所构成的树中,不但包括了连通图里的所有顶点(英语:Vertex
(graph theory)),且其所有边的权值之和亦为最小
图例
说明
不可选
可选
已选(Vnew)
此为原始的加权连通图。每条边一侧的数字...
分类:
编程语言 时间:
2015-05-27 15:58:39
阅读次数:
164
题目链接 poj 3678Katu PuzzleTime Limit:1000MSMemory Limit:65536KTotal Submissions:8340Accepted:3077DescriptionKatu Puzzle is presented as a directed graph...
分类:
其他好文 时间:
2015-05-27 15:28:06
阅读次数:
147
http://www.spoj.com/problems/QTREE/
QTREE - Query on a tree
no tags
You are given a tree (an acyclic undirected connected graph) with N nodes, and edges numbered 1, 2, 3...N-1.
We w...
分类:
其他好文 时间:
2015-05-27 12:25:26
阅读次数:
127
List ComponentsFor a given undirected graph with N vertices and E edges, please list all the connected components by both DFS and BFS. Assume that all...
分类:
其他好文 时间:
2015-05-27 09:44:09
阅读次数:
144
回溯法---n-着色问题(3) 以三色问题为例: 对给定无向图着色,相邻点颜色不能相同,限用3种颜色在框架基础上的实现:import java. util.Vector ;public class ThreeColor extends CombineProblem { int[][] graph; ...
分类:
其他好文 时间:
2015-05-26 20:48:59
阅读次数:
118
srcimg = $img; $this->resize_width = $wid; $this->resize_height = $hei; $this->cut = $c; //图片的类型 $this->type = strtolower(substr(strrchr($this->srcimg...
分类:
Web程序 时间:
2015-05-26 18:34:47
阅读次数:
169
ps -ef|grep xxx|grep -v grep|cut -c 7-15|xargs kill –9 root@vm-web1:~# ps -ef|grep dz2crm root 2296 1 0 Apr29 ? 00:01:23 php /var/www/dezhi/applicatio...
分类:
系统相关 时间:
2015-05-26 17:49:10
阅读次数:
204
每天凌晨运行切割日志的shell脚本
10 00* * * /bin/bash /usr/local/nginx/sbin/cut_nginx_log.sh
脚本如下
#!/bin/bash...
分类:
其他好文 时间:
2015-05-26 12:43:07
阅读次数:
138
问题:给定一段长度为n英寸的钢条和一个价格表pi(i=1,2,...,n),求切割钢条方案,使得销售收益rn最大。如果长度为n英寸的钢条的价格pn足够大,最优解可能就是完全不需要切割。
方法一:递归
从上而下把所有的全部搜索一遍
int CUT_ROD(int p[],int n)
{
if(n==0)
return 0;
int q=INT_MIN;
for(int i=1;i...
分类:
编程语言 时间:
2015-05-26 09:09:48
阅读次数:
227
package org.loda.graph;
import org.loda.structure.MinQ;
import org.loda.structure.Queue;
import org.loda.util.In;
/**
*
* @ClassName: KruskalMST
* @Description:Kruskal最小生成树算法
* @author...
分类:
编程语言 时间:
2015-05-26 06:54:36
阅读次数:
168