题意给出所有人之间的关系,单向的,问能不能将这群人分成两组,使得每组内部的任意两人都互相认识。先把单向边都换成无向边,即如果a,b互相认识那么不变,如果只是单向边的话那么则认为他们两个不认识,然后假设能分成满足题意的两个集合,那么新图的补图中这两个集合内部是没有边的,所以只要判断补图是不是二分图即可...
分类:
其他好文 时间:
2014-07-16 21:19:06
阅读次数:
191
1、将"(332、21)luck李。"中(332、21)抽取出来同时能够 将”(23)luck李。“中的(23)抽取出来pp = re.compile('(\(\d*(、\d*)?\))')mm = pp.match(line)print mm.groups()[0]2、
分类:
编程语言 时间:
2014-07-15 08:36:10
阅读次数:
293
Describe how you could use a single array to implement three stacks.Divide the array into three fixed parts, each stands for a stack./*Fixed Size Stac...
分类:
其他好文 时间:
2014-07-11 10:45:34
阅读次数:
189
到目前为止, 我们已经学习到了插入排序, 冒泡排序, 选择排序(selection)。 这些排序算法都是comparision based sorting algorithms(即涉及到元素大小的比较来决定元素的先后顺序)。 而且算法的时间复杂度上均为O(n^2)。但是comparision based 的排序算法远非这几个算法。 而且可以通过利用其它的一些手段(例如divide and conq...
分类:
编程语言 时间:
2014-07-11 08:29:25
阅读次数:
441
Notice:Given an array of strings, return all groups of strings that are anagrams.Note: All inputs will be in lower-case.For example:Input: ["tea","an....
分类:
其他好文 时间:
2014-07-10 14:44:00
阅读次数:
179
OJ题目:click here~~题目分析:n个人分为若干组 , 每一个人描写叙述其所在的组前面的人数和后面的人数。求这n个描写叙述中,最多正确的个数。设dp[ i ] 为前i个人的描写叙述中最多正确的个数,则dp[ n ] 为要求的。num[ i ][ j ] 保存说前面有i个人 , 后面有j个人...
分类:
其他好文 时间:
2014-07-09 17:35:02
阅读次数:
147
帐号配置:catauthz[groups]g_admin=admin,admin_rsyncg_库名=auser,buser,cuser,duser#库目录权限分配置[linuxspace:/]@g_admin=rw@g_PMC=r*=[linuxspace:/01workdir]@g_admin=rw@g_PMC=rauser=rw*=catpasswd[users]admin=passadmin_rsync=passauser=passSVN提交工作注意事项..
分类:
其他好文 时间:
2014-07-08 09:17:31
阅读次数:
198
Given an array of strings, return all groups of strings that are anagrams.Note: All inputs will be in lower-case.题目的意思是:给出一组字符串,按组返回拥有相同变位词的字符串解题思路是: ...
分类:
其他好文 时间:
2014-07-06 17:47:10
阅读次数:
210
Divide two integers without using multiplication, division and mod operator.思路:不能使用乘法除法以及取模运算来计算两个数相除。主要做法就是,将因子不断乘2(向左移位即可实现),同时结果从1不断移位加倍,等到除数大于被除数一...
分类:
其他好文 时间:
2014-07-06 15:34:24
阅读次数:
197
Update: July 4, 2014 Chap 5: At the beginning, he mentioned that: recursion is a divide-and-conquer method. Although many algorithms can be solved in ...
分类:
其他好文 时间:
2014-07-06 15:24:36
阅读次数:
213