题目一:
Given a binary tree containing digits from 0-9 only, each root-to-leaf
path could represent a number.
An example is the root-to-leaf path 1->2->3 which represents the number 123.
Fin...
分类:
其他好文 时间:
2014-05-26 04:06:41
阅读次数:
248
出题:要求将一个有序整数数组转换成最小深度的Binary Search
Tree表示;分析:由于需要是最小深度,所以BST应保持平衡,左右节点数大致相当,并且BST中当前根节点大于所有其左子树中的元素,小于所有其右子树中的元素。对于排序数组而言,中间元素必然作为根节点,然后递归对由中间元素分割的左右...
分类:
其他好文 时间:
2014-05-26 03:49:39
阅读次数:
369
例1: 批量 查询部门号为 "10" 号的并把它们打印出来 . DECLARE TYPE
emp_table_type IS TABLE OF my_emp%ROWTYPE INDEX BY BINARY_INTEGER; v_emp_table
emp_table_type;BEGIN SELE....
分类:
数据库 时间:
2014-05-26 01:26:47
阅读次数:
356
BinRes.h#ifndef
_waxie_binary_resource_h_#define _waxie_binary_resource_h_#include class BinRes
{public: BinRes(); virtual ~BinRes();public: static v....
分类:
其他好文 时间:
2014-05-26 00:32:02
阅读次数:
271
一、开发环境
Mac OS X 10.9.2 64位、Xcode5.1、MySQL5.5.37 64位
MySQL安装目录为:/usr/local/mysql
二、配置xcode连接mysql的编译选项
1> 将mysql头文件目录添加到xcode头文件搜索路径中
项目属性--> Build Settings --> Search Paths --> He...
分类:
数据库 时间:
2014-05-25 18:24:52
阅读次数:
386
寻找图中最小连通的路径,图如下:
算法步骤:
1. Sort all the edges in non-decreasing order of their weight.
2. Pick the smallest edge. Check if it forms a cycle with the spanning tree
formed so far. If cycle is n...
分类:
其他好文 时间:
2014-05-25 07:35:59
阅读次数:
301
Splay Tree 支持的之中操作。
插入,删除,求前驱和后即,区间更新与查询。
先来一发Splay Tree最基础的操作——伸展。
#include
#include
#include
#include
#include
#include
#include
#include
#include
#pragma comment(linker, "/STACK:102400...
分类:
其他好文 时间:
2014-05-25 04:27:37
阅读次数:
291
字典树Trie
Trie,又称字典树,前缀树(prefix tree),是一种树形结构,用于保存大量的字符串。
它的优点是:利用字符串的公共前缀来节约存储空间。查找、插入复杂度为O(n),n为字符串长度。
它有3个基本性质:
1. 根节点不包含字符,除根节点外每一个节点都只包含一个字符。
2. 从根节点到某一节点,路径上经过的字符连接起来,为该节点对应的字符串。...
分类:
其他好文 时间:
2014-05-24 23:49:57
阅读次数:
346
题目链接:点击打开链接
题意:有两种操作,合并集合,查询第K大集合的元素个数。(总操作次数为2*10^5)
Treap模板(静态数组)
#include
#include
#include
#include
#include
const int maxNode = 500000 + 100;
const int inf = 0x3f3f3f3f;
struct Tr...
分类:
其他好文 时间:
2014-05-24 23:18:09
阅读次数:
522
A bit is a binary digit, taking a logical value of either 1 or 0 (also referred to as "true" or "false" respectively). And every decimal number has a binary representation which is actually a series o...
分类:
其他好文 时间:
2014-05-24 17:19:41
阅读次数:
335