变量unordered_map cloneMap;
DFS:
UndirectedGraphNode *cloneGraph(UndirectedGraphNode *node) {
if (node == NULL) return NULL;
if (cloneMap.find(node) != cloneMap.end())...
分类:
其他好文 时间:
2014-10-09 01:23:57
阅读次数:
158
ConstraintsTime Limit: 1 secs, Memory Limit: 32 MBDescriptionDr lee cuts a string S into N pieces,s[1],…,s[N].Now, Dr lee gives you these N sub-string...
分类:
其他好文 时间:
2014-10-08 12:46:35
阅读次数:
369
[问题描述]Given a strings, partitionssuch that every substring of the partition is a palindrome.Return the minimum cuts needed for a palindrome partitioni...
分类:
其他好文 时间:
2014-10-07 01:23:32
阅读次数:
341
不要晃荡,找准方向[问题描述]Clone an undirected graph. Each node in the graph contains alabeland a list of itsneighbors.OJ's undirected graph serialization:Nodes a...
分类:
其他好文 时间:
2014-10-07 00:20:21
阅读次数:
208
OGNL表达式
OGNL(Object-Graph Navigation Language),可以方便地操作对象属性的开源表达式语言,使页面更简洁。主要用法有:
访问值栈中action的属性
username = 访问值栈中的对象的属性(需要get set方法)
| |
访问值栈中对象的方法
访问值栈中action的方法
访问静态方法
...
分类:
编程语言 时间:
2014-10-06 19:33:10
阅读次数:
219
Graph ReconstructionTime Limit: 2 Seconds Memory Limit: 65536 KB Special JudgeLet there be a simple graph with N vertices but we just know the degre.....
分类:
其他好文 时间:
2014-10-06 17:55:00
阅读次数:
259
题目链接:HDU 2454 Degree Sequence of Graph G
题意:给出N个点的度(简单图),问能能否画出个图,(其实就是给出一个串非负的序列是否有对应的图存在)
没见过这个定理 题意真的难懂。
havel定理就是一个给出一串非负的序列,存在一个无向图使得图中各点的度与此序列一一对应,则称此序列可图化。简单图的话就是,可简单图化。
可简单图化的判定(Havel定理):把...
分类:
其他好文 时间:
2014-10-06 12:15:30
阅读次数:
295
【leetcode】Given a string s, partition s such that every substring of the partition is a palindrome.Return the minimum cuts needed for a palindrome partitioning of s....
分类:
其他好文 时间:
2014-10-06 12:12:00
阅读次数:
149
拓扑排序要用list,不能用vector,确保删除边的开销为O(1)。因为主循环中,总共要从队列中pop掉n个数(点),然后总共要删e条边,删点和边的开销都是O(1)。所以整个时间复杂度就是O(n+e)。如果最终还剩下边,证明存在环,sort失败。 1 bool sort(list > &graph...
分类:
其他好文 时间:
2014-10-06 01:05:49
阅读次数:
163
///已知各点的度,判断是否为一个简单图
#include
#include
#include
using namespace std;
int a[1010];
bool cmp(int x,int y)
{
return x>y;
}
int main()
{
int t,n,i,j;
scanf("%d",&t);
while(t--)
{
...
分类:
其他好文 时间:
2014-10-05 20:05:39
阅读次数:
178