A binary tree is defined as a tree where each node can have no more than two children.Building a Binary Search Tree:首先创建一个节点Class public class BtNo...
分类:
编程语言 时间:
2015-11-20 17:35:58
阅读次数:
275
线段树(segment tree)是一种Binary Search Tree或者叫做ordered binary tree。对于线段树中的每一个非叶子节点[a,b],它的左子树表示的区间为[a,(a+b)/2],右子树表示的区间为[(a+b)/2+1,b]。如下图: ...
分类:
其他好文 时间:
2015-11-20 12:15:56
阅读次数:
134
DescriptionLittle Valentine liked playing with binary trees very much. Her favorite game was constructing randomly looking binary trees with capital l...
分类:
其他好文 时间:
2015-11-19 14:59:21
阅读次数:
113
题意: 给一棵二叉树,每个叶子到根的路径之和为sum的,将所有可能的路径装进vector返回。思路: 节点的值可能为负的。这样子就必须到了叶节点才能判断,而不能中途进行剪枝。 1 /** 2 * Definition for a binary tree node. 3 * struct Tr...
分类:
其他好文 时间:
2015-11-19 00:33:59
阅读次数:
230
Given a 2D binary matrix filled with 0's and 1's, find the largest square containing all 1's and return its area.For example, given the following matr...
分类:
其他好文 时间:
2015-11-19 00:33:41
阅读次数:
144
package com.smart.base;import org.apache.commons.codec.binary.Base64;public class Base64Test { private static String src = "imooc security base64";...
分类:
其他好文 时间:
2015-11-18 12:01:26
阅读次数:
116
### 类的深拷贝和浅拷贝1. 若要深拷贝,当前类和引用的类都需要支持序列化2. 扩展类的拷贝3. 代码示例````C# using System.Runtime.Serialization.Formatters.Binary;using System.IO;namespace ConsoleApp...
split(Subject, Pattern, Options) -> Parts将 Subject 按照 Pattern 分隔成列表,如果 Options global 没有给定,默认按照 Pattern 第一个模式来分隔 Subject。1> binary:split(>, [>,>],[])....
分类:
其他好文 时间:
2015-11-17 08:20:56
阅读次数:
176
Binary Tree Postorder TraversalGiven a binary tree, return thepostordertraversal of its nodes' values.Given binary tree{1,#,2,3}, 1 \ 2 / ...
分类:
其他好文 时间:
2015-11-17 06:49:39
阅读次数:
158
平衡二叉排序树
平衡二叉排序树(Balanced Binary Sort Tree),上一篇博客【数据结构】二叉排序树BST讲了BST,并且在最后我们说BST上的操作不会超过O(h),既然树高这么重要,那么BBST的研究就是为了使得树的深度在可接受的范围内渐近意义下达到O(lgn)
n个节点组成的二叉树,其高度为lgn取下限时,这棵树是理想平衡的,满足这样条件的树只有完全二叉树和满二叉树,这样...
分类:
编程语言 时间:
2015-11-17 00:26:20
阅读次数:
1194