静态字典树。 1 #include 2 #include 3 #include 4 5 #define MAXN 10005 6 7 typedef struct Trie { 8 bool v; 9 Trie *next[10];10 Trie() {11 ...
分类:
其他好文 时间:
2014-06-28 09:39:33
阅读次数:
171
【问题】
Sort a linked list using insertion sort.
【代码】
# Definition for singly-linked list.
# class ListNode:
# def __init__(self, x):
# self.val = x
# self.next = None
class Sol...
分类:
编程语言 时间:
2014-06-28 07:55:49
阅读次数:
199
迭代器模式(iterator pattern) 详解本文地址: http://blog.csdn.net/caroline_wendy迭代器模式(iterator pattern) : 提供一种方法顺序访问一个聚合对象中的各个元素, 而又不暴露其内部的表示;建立迭代器接口(iterator interface), 包含hasNext()方法和next()方法;不同聚合对象的具体的迭代器(concr...
分类:
其他好文 时间:
2014-06-28 07:43:35
阅读次数:
306
#include
#include
#include
#include
using namespace std;
struct Node
{
int data;
struct Node* next;
};
struct Node* create_list(int len)
{
if (len <= 0)
return NULL;
struct Node* head;
...
分类:
其他好文 时间:
2014-06-27 23:54:36
阅读次数:
311
KMP算法是通过分析模式字符串,预先计算每个位置发生不匹配的时候,所需GOTO的下一个比较位置,整理出来一个next数组,然后在上面的算法中使用。本全局匹配KMP算法针对串的堆式存储数据结构# define MAXSIZE 45 //固定next数组的长度# define OK 1# define....
分类:
其他好文 时间:
2014-06-27 22:29:03
阅读次数:
677
语言:C++描述:使用单链表实现,HeadNode是key=-1,value=-1,next=NULL的结点。距离HeadNode近的结点是使用频度最小的Node。 1 struct Node { 2 int key; 3 int value; 4 Node* next; 5...
分类:
其他好文 时间:
2014-06-27 18:48:42
阅读次数:
209
DFS+字典树。 1 #include 2 #include 3 #include 4 5 typedef struct Trie { 6 int v; 7 Trie *next[26]; 8 } Trie; 9 10 Trie root; 11 int ...
分类:
其他好文 时间:
2014-06-27 14:32:44
阅读次数:
183
Implement next permutation, which rearranges numbers into the lexicographically next greater permutation of numbers.
分类:
其他好文 时间:
2014-06-27 12:14:44
阅读次数:
191
字典树简单题。 1 #include 2 #include 3 #include 4 5 typedef struct Trie { 6 Trie *next[26]; 7 char str[15]; 8 } Trie; 9 10 Trie root;11 12 void c...
分类:
其他好文 时间:
2014-06-27 11:32:27
阅读次数:
172
#include #include using namespace std;class Student{public: Student (char *name); ~Student();public: char name[30]; Student *next; stat...
分类:
编程语言 时间:
2014-06-27 11:03:00
阅读次数:
199