码迷,mamicode.com
首页 >  
搜索关键字:__next__    ( 15001个结果
LeetCode -- Linked List Cycle
题目链接题意: 给出单链表, 判断是否存在环.方法就是大步小步...附上代码: 1 /** 2 * Definition for singly-linked list. 3 * struct ListNode { 4 * int val; 5 * ListNode *next...
分类:其他好文   时间:2014-05-20 01:46:54    阅读次数:308
线性表[ACM] (有bug)有待修改
1 #include "iostream" 2 #include "string" 3 using namespace std; 4 5 typedef struct node{ 6 string data; 7 struct node *next; 8 node(str...
分类:其他好文   时间:2014-05-19 22:08:01    阅读次数:368
AC自动机
hdu2222 字符串多模匹配算法 采用kuangbin模板#include #include #include #include #include using namespace std;struct Trie{ int next[500010][26],fail[500010],end[5...
分类:其他好文   时间:2014-05-19 08:36:17    阅读次数:234
字符串前缀,真前缀,后缀,真后缀,及前缀函数
举个例子,如字符串 ababc 首先,不考虑空字符,所有的前缀有a, ab, aba, abab, ababc,其中真前缀有a, ab, aba, abab 同理可以理解后缀,真前(后)缀就是指不包含自身的前(后)缀 前缀函数next[j]是指某个字符串的最长真后缀同时也是它的前缀的子串长度。不太理解可以看下面的例子 a -> 0 ab -> 0 aba -> 1 abab -> 2...
分类:其他好文   时间:2014-05-18 18:29:02    阅读次数:993
LeetCode: Next Permutation [030]
【题目】 Implement next permutation, which rearranges numbers into the lexicographically next greater permutation of numbers. If such arrangement is not possible, it must rearrange it as the lowest possible order (ie, sorted in ascending order). The replac...
分类:其他好文   时间:2014-05-18 09:54:53    阅读次数:242
Leetcode | Next Permutation
Implement next permutation, which rearranges numbers into the lexicographically next greater permutation of numbers.If such arrangement is not possibl...
分类:其他好文   时间:2014-05-17 23:39:30    阅读次数:272
邻接表
除了邻接矩阵外储存图的另一种方法,适用于稀疏图。用一个有n结点,p条边的有向图,用a[i],b[i],l[i]分别表示第i条边的起点,终点,权值。first[x]表示x号结点连出的第一条边,next[i]表示与第i条边是同一个结点连出的下一条边,如果为0则表示已经没有下一条了。初始化:用last[x...
分类:其他好文   时间:2014-05-17 22:29:48    阅读次数:468
链表的整表的创建
/这里是链表的创建其包含的是头指针phead,头节点,以及尾节点p->next = NULL 为链表创建结束标志。/判断指针为空十分重要,当然也不能忘了释放,代码是:if(head !=NULL){free(head);head = NULL;}head = (SLNode*)malloc(size...
分类:其他好文   时间:2014-05-17 19:40:54    阅读次数:255
List 循环的高效代码块
高效的代码块: /* Iterator it = al.iterator();//获取迭代器,用于取出集合中的元素。 while(it.hasNext()) { sop(it.next()); } ...
分类:其他好文   时间:2014-05-17 18:28:51    阅读次数:252
KMP超强模板贴一份
while(scanf("%s",str+1)==1){intn=strlen(str+1);next[1]=0;intj=0;for(inti=2;i2#include3#include4#include5#include6#include7#include8usingnamespacestd;9...
分类:其他好文   时间:2014-05-17 18:14:24    阅读次数:270
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!