描述:注意需要先self.connect(right)再self.connect(left),否则会有case通不过,原因是左边递归执行时依赖与右边的next已经建立,而先执行connect(left)的话右边还没有完成关系的建立。代码: 1 class Solution: 2 # @par...
分类:
其他好文 时间:
2014-08-01 19:15:42
阅读次数:
223
第二步:安装每个软件安装Vmware虚拟机点击“VMware-workstation-full-9.0.2-1031769”可执行文件,如下图所示:点击“Next”进入下一步: 我们选择“Custom”进入下一步;2.选择所有的功能,如下所示: 点击”Next”进入如下图所示界面: ...
分类:
其他好文 时间:
2014-08-01 15:56:51
阅读次数:
243
http://www.hanselman.com/blog/IntroducingASPNETVNext.aspxhttp://blogs.msdn.com/b/dotnet/archive/2014/05/12/the-next-generation-of-net-asp-net-vnext.as...
分类:
Web程序 时间:
2014-08-01 15:30:01
阅读次数:
195
问题:有一个单链表,其中可能有一个环,也就是某个节点的next指向的是链表中在它之前的节点,这样在链表的尾部形成一环。1、如何判断一个链表是不是这类链表?问题扩展:1.如果链表可能有环呢?2.如果需要求出两个链表相交的第一个节点呢?分析:在无环的情况下,如果两个链表有结点相同,那么它们下一结点也相同...
分类:
其他好文 时间:
2014-08-01 15:21:41
阅读次数:
183
#include
#include
typedef struct QNode
{ //构造结点类型
int data;
struct QNode *next;
}*QueuePtr;
typedef struct
{ QueuePtr front;
QueuePtr rear;
}LinkQueue;
void CreateQueue(LinkQueue &Q);//创建队列
void E...
分类:
其他好文 时间:
2014-08-01 13:51:24
阅读次数:
212
#include
#include
#include
typedef struct
{ char *ch;
int length;
}HString;
void StrAssign(HString &T,char chars[]);
int get_next(HString T,int next[]);
void main()
{ HString T;
char chars[80];
in...
分类:
其他好文 时间:
2014-08-01 13:51:23
阅读次数:
229
UVA 1328 - Period
题目链接
题意:给定一个字符串,求出有几个位置的前缀串是由个数大于1的串循环得到的,求出位置和循环次数
思路:利用kmp的next数组的性质,i - next[i]就是循环长度,然后判断一下是不是正好是倍数即可
代码:
#include
#include
const int N = 1000005;
int n, next[...
分类:
其他好文 时间:
2014-08-01 13:49:11
阅读次数:
171
Next time you see a numeric problem has a too straightforward solution, think about optimized one.Like this one: recursion\iteration is tooo slow. SoD...
分类:
其他好文 时间:
2014-08-01 06:57:01
阅读次数:
279
Populating Next Right Pointers in Each NodeGiven a binary tree struct TreeLinkNode { TreeLinkNode *left; TreeLinkNode *right; TreeLi...
分类:
其他好文 时间:
2014-07-31 23:25:40
阅读次数:
292
Populating Next Right Pointers in Each Node IIFollow up for problem "Populating Next Right Pointers in Each Node".What if the given tree could be any ...
分类:
其他好文 时间:
2014-07-31 23:16:30
阅读次数:
182