题目链接:uva 1264 - Binary Search Tree
题目大意:给定一个插入顺序,要求输出有多少种插入顺序,使得生成的BST一样。
解题思路:组合数学+BST的性质,起始左右两个子树的节点之间是没有影响的。所以逐层递推上去即可。
#include
#include
#include
using namespace std;
typedef long long...
分类:
其他好文 时间:
2014-09-16 10:45:40
阅读次数:
314
题目:https://oj.leetcode.com/problems/add-binary/Given two binary strings, return their sum (also a binary string).For example,a = "11"b = "1"Return "10...
分类:
编程语言 时间:
2014-09-16 10:31:00
阅读次数:
174
Given a binary tree, flatten it to a linked list in-place.For example,Given 1 / \ 2 5 / \ \ 3 4 6The flattened t...
分类:
其他好文 时间:
2014-09-16 04:57:10
阅读次数:
134
Given a binary tree, find its maximum depth.The maximum depth is the number of nodes along the longest path from the root node down to the farthest le...
分类:
其他好文 时间:
2014-09-16 00:15:49
阅读次数:
196
树是一种非线性的数据结构,树有根节点,子树等概念。
二叉树(Binary Tree):每个节点最多有两颗子树,并且子树有左右之分。
概念:树的深度,满二叉树,完全二叉树,树的节点树
二叉树包括顺序存储和链式存储,这里只说链式存储。二叉树的每个节点和双链表有些类似,但是树的结构要比双链表复杂,在构造树的过程中涉及到递归调用的问题,递归的问题往往是很复杂的问题,因此,这里单独说二叉树的构建。
...
分类:
其他好文 时间:
2014-09-15 19:36:19
阅读次数:
142
Path Sum
Given a binary tree and a sum, determine if the tree has a root-to-leaf path such that adding up all the values along the path equals the given sum.
For example:
Given the below binary...
分类:
其他好文 时间:
2014-09-15 17:54:12
阅读次数:
229
在查看了ubuntu的debian rules,重新配置chromium
GYP_GENERATORS=make GYP_DEFINES="disable_sse2=1 use_third_party_translations=1 werror= sysroot= disable_nacl=1 linux_use_gold_binary=0 linux_use_gold_flags=0 enab...
分类:
其他好文 时间:
2014-09-15 14:23:38
阅读次数:
231
Given a binary tree, return the bottom-up level order traversal of its nodes' values. (ie, from left to right, level by level from leaf to root).For e...
分类:
其他好文 时间:
2014-09-15 14:13:38
阅读次数:
153
Given a binary tree, return the level order traversal of its nodes' values. (ie, from left to right, level by level).For example:Given binary tree {3,...
分类:
其他好文 时间:
2014-09-15 14:07:38
阅读次数:
175
Given a binary tree, find the maximum path sum.
The path may start and end at any node in the tree.
For example:
Given the below binary tree,
1
/ 2 3
Return 6....
分类:
其他好文 时间:
2014-09-15 12:58:38
阅读次数:
168