来到周末,小匹夫终于有精力和时间来更新下博客了。前段时间小匹夫读过一份代码,对其中各种数据结构灵活的使用赞不绝口,同时也大大激发了小匹夫对各种数据结构进行梳理和总结的欲望。正好最近也拜读了若干大神的文章,觉得总结下常用的数据结构以供自己也能灵活的使用变得刻不容缓。那么还是从小匹夫的工作内容入手,就谈 ...
分类:
编程语言 时间:
2017-12-18 12:08:54
阅读次数:
298
#include #include #define MAX 26 using namespace std; typedef struct TrieNode //Trie结点声明 { bool isStr; //标记该结点处是否构成单词 struct TrieNode *next... ...
分类:
其他好文 时间:
2017-12-17 23:58:18
阅读次数:
269
【CF888G】Xor-MST 题意:给你一张n个点的完全图,每个点有一个权值ai,i到j的边权使ai^aj,求这张图的最小生成树。 n<=200000,ai<2^30 题解:学到了求最小生成树的新姿势。 Boruvka算法:先对于每个点,选择在所有与之相连的边中,权值最小的边,并将这条边加入到最小 ...
分类:
其他好文 时间:
2017-12-17 15:00:19
阅读次数:
219
http://guides.rubyonrails.org/active_record_querying.html This guide covers different ways to retrieve data from the database using Active Record. Aft ...
分类:
其他好文 时间:
2017-12-17 13:25:20
阅读次数:
199
Implement a trie with insert, search, and startsWith methods. Note: You may assume that all inputs are consist of lowercase letters a-z. var Trie = fu... ...
分类:
其他好文 时间:
2017-12-14 22:52:28
阅读次数:
143
一、概述 LinkedHashMap继承自HashMap,是Map接口的一个具体实现,它是有序的,可以按照插入顺序先后和访问时间先后进行排序,选择哪种排序方式取决于在新建LinkedHashMap的时候是否指定了accessOrder为true。如果不指定,accessOrder默认为false,L ...
分类:
其他好文 时间:
2017-12-14 18:02:41
阅读次数:
165
最近在学习 ELK,为了尝试和练手,我申请了 AWS EC2 micro instance (一年免费使用的主机),内存为 1G. 在安装 ElasticSearch, Logstash, Kibana 的过程中,整个过程还是比较顺利,但是也遇到了一个非常头疼的问题,就是 Kibana 的 X Pa ...
分类:
其他好文 时间:
2017-12-13 02:24:38
阅读次数:
185
trie合并的裸题...因为最多只有n个点,所以最多合并n次,复杂度$O(N*26)$。 #include<iostream> #include<cstring> #include<cstdlib> #include<cstdio> using namespace std; const int ma ...
分类:
其他好文 时间:
2017-12-12 14:59:37
阅读次数:
207
trie树的异或和问题 本题是一道经典题,使用trie树维护所给出的集合,我们知道等比数列前n项的和比第n+1项小,所以本题可以使用贪心策略,对于每一个询问,我们从高位向低位匹配,寻找最大异或值,向下递归求解。 cpp include include include include include ...
分类:
其他好文 时间:
2017-12-09 12:00:05
阅读次数:
149
```cpp include include include include include include using namespace std; const int MAXN=5e6+5; int nume,n,m; char s[55],fff[4][20]={" ","OK","WRONG ...
分类:
其他好文 时间:
2017-12-08 23:07:25
阅读次数:
228