Given a binary tree, return thezigzag level ordertraversal of its nodes' values. (ie, from left to right, then right to left for the next level and al...
分类:
其他好文 时间:
2014-07-22 22:53:33
阅读次数:
229
经典kmp 1 #include 2 #include 3 using namespace std; 4 5 int n,m; 6 int a[1000010],b[10010],next[10010]; 7 8 void getnext (int *s,int *next)...
分类:
其他好文 时间:
2014-07-22 22:52:33
阅读次数:
182
经典kmpps:poj 2046Power Strings 是这题的简化版 ←_←太水就不贴代码了。。。#include #include #include using namespace std;const int maxn=1000010;char s[maxn];int next[maxn];...
分类:
其他好文 时间:
2014-07-22 22:52:16
阅读次数:
209
以前对java中迭代方式总是迷迷糊糊的,今天总算弄懂了,特意的总结了一下,基本是算是理解透彻了。
1.再说Map之前先说下Iterator:
Iterator主要用于遍历(即迭代访问)Collection集合中的元素,Iterator也称为迭代器。它仅仅只有三个方法:hasNext(),next()和remove()
hasNext():如果仍有元素可以迭代,则返回 true。(换句话说,如...
分类:
编程语言 时间:
2014-07-19 23:28:49
阅读次数:
359
先从一个例子开始讲起,以下是jdk1.7中的迭代器接口的代码(去掉了注释的部分): public interface Iterator { boolean hasNext(); E next(); void remove();} 程序开发的老油条们都不太喜欢这个接口的remove方法,原因可能是: ...
分类:
其他好文 时间:
2014-07-19 23:01:14
阅读次数:
206
poj3461:http://poj.org/problem?id=3461题意:求一个串在另一个串中出现的次数。题解:直接套用KMP即可,在统计的时候做一下修改。找到之后不是直接返回,而是移动i-(j-next[j])位。 1 #include 2 #include 3 #include 4 #d...
分类:
其他好文 时间:
2014-07-19 18:30:48
阅读次数:
137
poj2406:http://poj.org/problem?id=2406题意:给你一个串,让你找出这个串是由哪个串循环得到,出处循环的次数。题解;知道了KMP,用next数组直接搞定。判断ans=len%(len-next[len])==0?len/(len-next[len]):1; 1 #i...
分类:
其他好文 时间:
2014-07-19 12:21:07
阅读次数:
391
下面讲的是一个意思:The problem is that the next control in the tab order following the last radiobutton of your group must have the WS_GROUP flag set.1:ex:Cont...
分类:
其他好文 时间:
2014-07-19 09:27:10
阅读次数:
176
执行 For Each...Next 循环时,在 GetEnumerator 方法返回的枚举数对象的控制下遍历集合。遍历的顺序不是由.NET确定的,而是由枚举数对象的 MoveNext 方法决定的。这意味着可能无法预测 elementvariable 首先返回集合中的哪个元素,也无法预测在某个给定的...
分类:
其他好文 时间:
2014-07-19 00:12:09
阅读次数:
311
1.Iterable接口在java.lang包中;Iterator接口在java.util包中2.Iterable中只有一个方法,那就是返回一个Iterator迭代器:Iterator iterator() 而Iterator中有关于迭代器的核心功能,next(),hasNext(),remove(...
分类:
编程语言 时间:
2014-07-18 19:06:45
阅读次数:
4190