生成器>>> def func1():... yield 0... yield 1... >>> a=func1()>>> a.next()0>>> a.next()1>>> a.next()Traceback (most recent call last): File "", l...
分类:
编程语言 时间:
2014-07-06 20:07:34
阅读次数:
251
$(function(){ var $next=$(".right"); var $prev=$(".left"); var $list_num=$(".list-num a"); var $banner=$(".banner"); var $list_banner=$(".list-banner"...
分类:
Web程序 时间:
2014-07-06 19:23:10
阅读次数:
200
初次安装使用GNS3,安装的版本是GNS3-0.8.6-all-in-one,本人也是菜鸟,安装时都是一路 Next,结果安装后运行出现了这样的问题,如图language里是没有选项的,解决方法把之前安装的GNS3,wireshark和winPcap彻底的卸载干净,重新安装。安装时不要勾选wires...
分类:
其他好文 时间:
2014-07-06 18:35:56
阅读次数:
387
上周算法班的BEN老师花了1个小时讲自动机和KMP的关系,结果failed...明天又要上课了,花了半天时间看了下KMP,暂且停留在利用next求模式中的跳跃长度,自动机那个还不能理解。。。具体的可以百度阮一峰的KMP算法。看着什么前缀后缀,突然想到上下文无关文法乔姆斯基范式了。。。。又想到了NFA...
分类:
其他好文 时间:
2014-07-06 17:00:42
阅读次数:
170
DescriptionThe cows have purchased a yogurt factory that makes world-famous Yucky Yogurt. Over the next N (1 #includeint min(int a,int b){ if(a>b) ...
分类:
其他好文 时间:
2014-07-06 14:21:54
阅读次数:
215
简单的插入排序,总是超时,暂且放在这记录一下。
class Solution:
# @param head, a ListNode
# @return a ListNode
def insertionSortList(self, head):
if head == None or head.next == None:
return head
psuhead...
分类:
编程语言 时间:
2014-07-06 11:52:20
阅读次数:
230
可以练习下链表的逆置。
def PrintListReversingly(head):
if head == None:
return
if head:
PrintListReversingly(head.next)
print head.val
def reverse(head):
if head == None or head.next == None:
return...
分类:
其他好文 时间:
2014-07-06 09:29:57
阅读次数:
214
Description: Given two strings, write a method to decide if one is a permutation of the other.We could use the same idea from CTCI 1.1. The only diffe...
分类:
其他好文 时间:
2014-07-05 21:43:01
阅读次数:
231
链接:http://acm.hdu.edu.cn/showproblem.php?pid=4333
题意:给以数字字符串,移动最后若干位到最前边,统计得到的数字有多少比原来大,有多少和原来相同,有多少比原来的小。
思路:拓展KMP中的next数组标记的是子串和母串的公共前缀的长度,要将字符串长度变成原来二倍,这样如果变换后不是完全相同的数字也即公共前缀长度大于等于字符串长度,那么字母串公共前缀...
分类:
其他好文 时间:
2014-07-04 08:42:50
阅读次数:
355
Populate each next pointer to point to its next right node. If there is no next right node, the next pointer should be set to NULL.
分类:
其他好文 时间:
2014-07-03 23:46:37
阅读次数:
389