题目:给你一些单词(数字和字母构成),再给你几行文章,要求建立单词所在行数的索引。
分析:字符串、字典树。这题好恶心,数据范围完全没有╮(╯▽╰)╭,57次提交才AC。
数据分为单词表和文章两部分,每部分由一个空行做结束标志。
首先,将单词中的小写字母全部转化成大写字母,然后存入字典树。
然后,查找时将文章中所有的小写...
分类:
其他好文 时间:
2014-06-05 11:37:56
阅读次数:
229
利用HTML5的新特点做文件异步上传非常简单方便,本文主要展示JS部分,html结构。下面的代码并未使用第三发库,如果有参照,请注意一些未展现出来的代码片段。我这边的效果预览:
1.文件未选择 2.文件已选择
HTML代码部分:
思路:下面代码中我利用css的z-index属性将input="file”标签隐藏在了id=btnSelect元素下面,通过触发a标签的点击后,弹出文件选择...
分类:
Web程序 时间:
2014-06-05 11:11:06
阅读次数:
245
题目如下:
S-Trees
A Strange Tree (S-tree) over the variable set is a binary tree representing a Boolean function
.Each path of the S-tree begins at the
root node and consists ...
分类:
其他好文 时间:
2014-06-05 11:04:37
阅读次数:
248
本文出自 http://blog.csdn.net/shuangde800
题目传送门
题意:
给出一棵树,求离每个节点最远的点的距离
思路:
把无根树转化成有根树分析,
对于上面那棵树,要求距结点2的最长距离,那么,就需要知道以2为顶点的子树(蓝色圈起的部分,我们叫它Tree(2)),距顶点2的最远距离L1...
分类:
其他好文 时间:
2014-06-05 06:56:39
阅读次数:
226
题目如下:
Tree
You are to determine the value of the leaf node in a given binary treethat is the terminal node of a path of least value from the root of thebinary tree to any le...
分类:
其他好文 时间:
2014-06-05 05:27:11
阅读次数:
268
注意:
1 判断一个节点是否平衡的方法
2 平衡一个节点的方法 :
我这里比原文改进一点,独立出一个平衡节点的函数balanceNode(),这样一个函数可以用来平衡插入和删除操作,使得代码更加简洁了。
这样修改之后就使得平衡二叉树好像和一般二叉树的操作比较,就是多了一个平衡操作。
3 删除操作情况很多,很困难,一定要理清思路。十分容易出bug的地方。
这里是查找后继节点的值,填补上到...
分类:
其他好文 时间:
2014-06-05 05:16:45
阅读次数:
261
题目如下;
Quadtrees
A quadtree is a representation format used to encode images. The fundamental ideabehind the quadtree is that any image can be split into four quadrants. Each...
分类:
其他好文 时间:
2014-06-05 04:20:06
阅读次数:
226
区间的查询,点修改,插入和删除。先姑且当作模板吧,略挫,慢慢补充,慢慢优化。
#include
#include
#include
#include
#include
#include
#include
#include
#include
#pragma comment(linker, "/STACK:1024000000");
#define EPS (1e-8)
#d...
分类:
其他好文 时间:
2014-06-05 02:01:37
阅读次数:
400
对于递归函数:参数,局部变量的生存期和调用时间问题
==================================================================================================
#include
int binary_to_ascii( unsigned int value)
{
unsigned in...
分类:
其他好文 时间:
2014-06-04 23:33:41
阅读次数:
351
Jump Game IIGiven an array of non-negative
integers, you are initially positioned at the first index of the array.Each
element in the array represents...
分类:
其他好文 时间:
2014-05-31 03:14:14
阅读次数:
243