Problem Description:Clone an undirected graph. Each node in the graph contains alabeland a list of itsneighbors.Solution: 1 public UndirectedGraph...
分类:
其他好文 时间:
2014-07-07 16:11:57
阅读次数:
192
1、相关术语顶点(Vertex)、弧(Arc)、弧头(初始点)、弧尾(终结点)、边(Edge)、有向图(Directed graph)、无向图(Undigraph)、全然图(Completed grapg)、有向全然图、稀疏图(Sparse graph)、稠密图(Dense graph)、权(wei...
分类:
其他好文 时间:
2014-07-06 18:51:14
阅读次数:
321
题目如下:
Play on Words
Some of the secret doorscontain a very interesting word puzzle. The team of archaeologists has tosolve it to open that doors. Because there is no other way to open the doors,...
分类:
其他好文 时间:
2014-07-06 12:12:36
阅读次数:
221
题目如下:
Problem D: XYZZY
ADVENT: /ad?vent/, n.
The prototypical computer adventure game, first designed by Will Crowther on the PDP-10 in the mid-1970s as an attempt at computer-refereed fantasy...
分类:
其他好文 时间:
2014-07-03 18:09:47
阅读次数:
211
题目如下:
Dungeon Master
You are trapped in a 3D dungeon and need to find the quickest way out!The dungeon is composedof unit cubes which may or may not be filled with rock. It ...
分类:
其他好文 时间:
2014-07-02 16:53:39
阅读次数:
199
题目如下:
Slash Maze
By filling a rectangle with slashes (/) and backslashes (), youcan generate nice little mazes. Here is an example:
As you can see, paths in the maze cann...
分类:
其他好文 时间:
2014-07-02 09:07:46
阅读次数:
186
题目链接:点击打开链接
题意:
给定n个点m条边的无向图
求从1点开始经过每条边至少一次最后回到1点的最小路程
显然就是找一条路径可重复的欧拉回路
思路:
首先对于欧拉回路的结论是:所有点的度数都为偶数
因为所有边至少经过一次,那么可以把题意转换成加最少多少条边使得图满足以上结论
而加的边目的是为了把奇度数转成偶度数,先floyd一下得到任意点间加边的最小花费
dp[i]表示状态...
分类:
其他好文 时间:
2014-07-01 14:47:43
阅读次数:
274
仿写 networkx 的功能
# -*- coding: cp936 -*-
'''
简单图 Graph:
要求:
关于节点:
功能1.add_node:
通过 add_node 一次性加一个节点
字符串,数字,任何可以被哈希的 python 对象都可以当做节点
...
分类:
其他好文 时间:
2014-07-01 08:15:24
阅读次数:
281
题目如下:
Maze Exploration
A maze of rectangular rooms is represented on a twodimensional grid as illustrated in figure 1a. Each point of thegrid is represented by a character. ...
分类:
其他好文 时间:
2014-07-01 06:57:08
阅读次数:
231
题目
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 separa...
分类:
其他好文 时间:
2014-06-30 09:01:23
阅读次数:
197