A graph which is connected and acyclic can be considered a tree. The height of the tree depends on the selected root. Now you are supposed to find the...
分类:
其他好文 时间:
2015-02-27 09:56:06
阅读次数:
110
1、lnoi.sh:列出当前系统下每个IP的连接数:#catlnoi.sh#!/bin/bash
#UseforlistconnectnumbersandIPaddress.
netstat-n|grep‘^tcp‘|grep-v‘127.0.0.1‘|awk‘{print$5}‘|cut-d:-f1|sort|uniq-c|sort-rn|awk‘BEGIN{printf"%-10s%s\n","ConNum","IP"}{printf"%-11s%s\n",$1,$2}..
分类:
其他好文 时间:
2015-02-27 01:38:42
阅读次数:
208
1.balls数组中的元素个数有增无减,考虑将滚到画面外的小球排出balls数组;function updateBalls(){ ...... var cut = 0; for( var i = 0 ; i 0 && balls[i].x-RADIUScut)//前cut个小球在屏...
分类:
编程语言 时间:
2015-02-26 21:36:16
阅读次数:
195
http://acm.hdu.edu.cn/showproblem.php?pid=4635
Problem Description
Give a simple directed graph with N nodes and M edges. Please tell me the maximum number of the edges you can add that the gr...
分类:
其他好文 时间:
2015-02-26 18:35:11
阅读次数:
148
Clone an undirected graph. Each node in the graph contains a label and a list of its neighbors.
OJ's undirected graph serialization:
Nodes are labeled uniquely.
We use # as a separator for each...
分类:
编程语言 时间:
2015-02-26 11:41:10
阅读次数:
181
棋盘覆盖2^k的棋盘格子,有一个缺陷,用L形状的的拼图把棋盘覆盖。每次涂抹的时候先按照缺陷的四周涂抹……23333参考int dir[4][2] = {{0,0},{0,1},{1,0},{1,1}}; ///棋盘L形状对应的分别缺少那个格子int graph[10000][10000];void....
分类:
其他好文 时间:
2015-02-24 22:12:17
阅读次数:
174
Problem Description
For a tree, which nodes and edges are all weighted, the ratio of it is calculated according to the following equation.
Given a complete graph of n nodes with all nodes and edges weighted, your task is to find a tree, which is a sub...
分类:
其他好文 时间:
2015-02-24 09:09:36
阅读次数:
142
刚一拿到这道题把他想的太复杂了
明明是长度最大为十的顺序结构就能解决的问题,竟然优先想到用链表。
BFS牵扯到一个队列的操作,在这种小规模数据里面 用顺序结构好很多
题目如下:
For a given undirected graph with N vertices and E edges, please list all the connected...
分类:
其他好文 时间:
2015-02-24 09:09:25
阅读次数:
242
Given a connected undirected graph, tell if its minimum spanning tree is unique.
Definition 1 (Spanning Tree): Consider a connected, undirected graph G = (V, E). A spanning tree of G is a subgraph of G, say T = (V', E'), with the following properties:
1...
分类:
其他好文 时间:
2015-02-23 15:33:46
阅读次数:
257
题目大意:
提一个无向有重边的图,有重边的边权累加起来,求全局最小割。
思路:
一个无向连通图,去掉一个边集可以使其变成两个连通分量则这个边集就是割集。最小割
集当然就是权和最小的割集。
这是一个最简单的全局最小割模板题。直接套上模板就可以了。来说说Stoer-Wangner算
法吧。
Stoer-Wangner算法:
对于图中的任意两个顶点u和v,若u,v属于最小割的同一个集合中,那么僵顶点u和顶点
v合并后并不影响图的最小割。那么,如果能求出图中某两个顶点之间的最小割,更新答案
后合并这两个顶点继续求...
分类:
其他好文 时间:
2015-02-20 23:12:06
阅读次数:
361