题目链接:http://poj.org/problem?id=2503
题意:翻译单词,若在词典中找不到则输出eh。
思路:裸的字典树。
代码:
#include
#include
#include
#include
#include
#include
#include
using namespace std;
#define lson l, m,...
分类:
其他好文 时间:
2015-08-17 23:38:14
阅读次数:
131
题目链接:http://acm.hdu.edu.cn/showproblem.php?pid=1075
题意:根据词典翻译语句。
思路:裸的字典树。每个节点存以该节点为结尾的对应的单词。
代码:
#include
#include
#include
#include
#include
#include
#include
using namespace...
分类:
其他好文 时间:
2015-08-17 23:38:55
阅读次数:
113
前言:本文章来源于我在知乎上回答的一个问题
AVL树,红黑树,B树,B+树,Trie树都分别应用在哪些现实场景中?
看完后您可能会了解到这些数据结构大致的原理及为什么用在这些场景,文章并不涉及具体操作(如插入删除等等)
目录
AVL树
AVL树原理与应用
红黑树
红黑树原理与应用
B/B+树
B/B+树原理与应用
Trie树
Trie树原理与应用
AVL树
简介:
AV...
分类:
其他好文 时间:
2015-08-17 23:38:16
阅读次数:
361
1,状态记录:
目前的状态:
(1)STM32F405R程序下载没有问题,LED测试程序OK
(2)nRF51822 256K程序下载没有问题,LED测试程序OK
(3)STM32F405R驱动MPU9250没有问题,可以正确的读取到ID
(4)nRF51822 256K的crazyflie20程序可以下载,可以进入Bootloader,从手机端看到nRF51822 BLE的...
分类:
其他好文 时间:
2015-08-17 23:37:06
阅读次数:
292
题目链接
题意:
有n个人要进行乒乓球比赛,每个人都一个能力值,每个人出现的次序就是他们住的位置
现在要求进行一场比赛,三个人,裁判的能力值在两个选手之间,住的位置也在两个人的之间
问这种比赛一共可以进行多少次
思路:
用树状数组做,否则TLE,先从左到右扫一遍,计算每点左边大的个数和小的个数,
再从右到左扫一遍,计算每点右边大和小的个数,然后交叉相乘取和就可以了
代码如下:
...
分类:
其他好文 时间:
2015-08-17 23:37:53
阅读次数:
161
find the safest road
Time Limit: 10000/5000 MS (Java/Others) Memory Limit: 32768/32768 K (Java/Others)
Total Submission(s): 9168 Accepted Submission(s): 3238
Problem Description
XX星球有很多城...
分类:
其他好文 时间:
2015-08-17 23:38:25
阅读次数:
166
字典树
将每个字符串的所有前缀插入进树,采用ID防止重复即可
#include
#include
#include
using namespace std;
string str;
int n;
int id;
struct stu
{
int m;
int id;
stu* a[26];
stu()
{
m=id=0;
//memset(a,NULL,sizeof(a))...
分类:
其他好文 时间:
2015-08-17 23:36:19
阅读次数:
151
#define SIG_ERR (void (*)())-1
#define SIG_DEL (void (*)())0
#define SIG_IGN (void (*)())1为什么不是#define SIG_ERR (void (*) (int))-1 呢?在网上搜索之后找到答案:
在C里这样的代码是可以的void fun();
int main()
{
fun(1,2);...
分类:
其他好文 时间:
2015-08-17 23:36:49
阅读次数:
185
2011.10.6烛秋 http://www.cnblogs.com/cswuyg/archive/2011/10/06/DLL2.html一、导出类的简单方式这种方式是比较简单的,同时也是不建议采用的不合适方式。只需要在导出类加上__declspec(dllexport),就可以实现导出类。对象空...
分类:
其他好文 时间:
2015-08-17 23:37:14
阅读次数:
161
DescriptionThere is a hill with n holes around. The holes are signed from 0 to n-1.A rabbit must hide in one of the holes. A wolf searches the rabbit ...
分类:
其他好文 时间:
2015-08-17 23:36:52
阅读次数:
198
Data URL 早在 1995 年就被提出,那个时候有很多个版本的 Data URL Schema 定义陆续出现在 VRML 之中,随后不久,其中的一个版本被提上了议案——将它做个一个嵌入式的资源放置在 HTML 语言之中。从 RFC 文档定稿的时间来看(1998年),它是一个很受欢迎的发明。Da...
分类:
其他好文 时间:
2015-08-17 23:37:05
阅读次数:
193
/** * The default initial capacity - MUST be a power of two. */ static final int DEFAULT_INITIAL_CAPACITY = 16; /** * The maximum ca...
分类:
其他好文 时间:
2015-08-17 23:35:28
阅读次数:
175
说明:本次实验利用中序和先序序列,采用递归方式来构建二叉树 。经过几天的失败和思考,我认为递归构建二叉树的过程中最重要的是递归单元,最麻烦的是递归参数的选择和传递。简单将算法过程用如下流程图来表示:(本帖所用算法及图片均为原创内容,转贴注明出处)算法:1.根据先序序列,建立根结点T 2.寻找中序序列...
分类:
其他好文 时间:
2015-08-17 23:32:40
阅读次数:
253
Given a binary tree, return all root-to-leaf paths.For example, given the following binary tree: 1 / \2 3 \ 5All root-to-leaf paths are:["1->...
分类:
其他好文 时间:
2015-08-17 23:34:41
阅读次数:
110
1)都实现了 Map 接口,HashMap 允许将 null 作为一个 entry 的 key 或者 value,而 Hashtable 不允许。2)HashMap 把 Hashtable 的 contains 方法去掉了,改成 containsValue 和containsKey。3)Hashta...
分类:
其他好文 时间:
2015-08-17 23:34:42
阅读次数:
173
将网卡enp0s8、enp0s9进行链路绑定安装teamd包# yum install teamd创建一个team链接# nmcli con add con-name team0 type team ifname team0 config '{"runner":{“name”:"activeback...
分类:
其他好文 时间:
2015-08-17 23:33:33
阅读次数:
251
一、数据库他的pid是上级的id二、php//获取所有的数据$pdo = new PDO("mysql:host=localhost;dbname=lamp108",'root','');$pdo->query("SET NAMES GBK");$stmt = $pdo->query("select...
分类:
其他好文 时间:
2015-08-17 23:32:45
阅读次数:
164