一、基本数据结构 1 union m_block 2 { 3 union m_block* next; 4 unsigned int size; 5 }; 6 7 struct m_list 8 { 9 union m_block* free;...
分类:
系统相关 时间:
2014-06-19 07:59:56
阅读次数:
309
#include "stdafx.h"#include "stdlib.h"typedef struct Node{ int data; struct Node* next;} LinkNode;void PrintNodes(LinkNode *&List){ LinkNode ...
分类:
其他好文 时间:
2014-06-17 15:25:14
阅读次数:
158
#include#include#includeint k,h[110],mark;struct M{ int data; struct M *next;}*head[110];void init(){ int i; for(i = 0; i next = NULL; ...
分类:
其他好文 时间:
2014-06-17 00:58:16
阅读次数:
315
链表中的“p->next”p->next到底是指p的下一个节点还是p的指针域呢?p是一个指针,那么p->next也应该是一个指针,即p->next应该是一个地址,因此p->next其实是p指向的节点的指针域(next域),所以p->next还是属于当前节点的,只不过它是下一个节点的地址罢了。所以如果...
分类:
编程语言 时间:
2014-06-17 00:45:56
阅读次数:
348
我们在一个母字符串中查找一个子字符串有很多方法。KMP是一种最常见的改进算法,它可以在匹配过程中失配的情况下,有效地多往后面跳几个字符,加快匹配速度。当然我们可以看到这个算法针对的是子串有对称属性,如果有对称属性,那么就需要向前查找是否有可以再次匹配的内容。在KMP算法中有个数组,叫做前缀数组,也有...
分类:
其他好文 时间:
2014-06-17 00:24:23
阅读次数:
212
继续校赛前的建图任务,当时只写了DFS遍历,今天把BFS也写了一下。
#include
#include
#include
#include
#include
const int maxe = 10001;
using namespace std;
struct node{
int to,w;
node *next;
}*head[maxe];//he...
分类:
其他好文 时间:
2014-06-16 22:25:20
阅读次数:
286
PHP 获取数组任意下标key的上一个prev和下一个next下标值
$value){
$steps->add($key);
}...
分类:
Web程序 时间:
2014-06-16 22:07:56
阅读次数:
308
题目
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 low...
分类:
其他好文 时间:
2014-06-16 18:48:33
阅读次数:
170
打印全排列是个有点挑战的编程问题。STL提供了stl::next_permutation完美的解决了这个问题。
但是,如果不看stl::next_permutation,尝试自己解决,怎么做?
很自然地,使用递归的办法:
1. 单个元素的排列只有1个。
2. 多个元素的排列可以转化为:
以每个元素为排列的首个元素,加上其他元素的排列。
有了思路,就可以编码了。
第一个...
分类:
其他好文 时间:
2014-06-14 15:10:03
阅读次数:
263
1. trie树,又名字典树,顾名思义,它是可以用来作字符串查找的数据结构,它的查找效率比散列表还要高。
trie树的建树:
比如有字符串”ab” ,“adb”,“adc” 可以建立字典树如图:
树的根节点head不存储信息,它有26个next指针,分别对应着字符a,b,c等。插入字符串ab时,next[‘a’-‘a’]即next[0]为空,这...
分类:
其他好文 时间:
2014-06-14 14:25:50
阅读次数:
406