一、二叉树 1、定义 二叉树是一棵树,其中每个节点都不能多于2个儿子。 2、实现 typedef struct TreeNode *PtrToNode;typedef PtrToNode Tree;typedef char ElementType;struct TreeNode{ ElementTy...
分类:
其他好文 时间:
2014-09-01 13:49:03
阅读次数:
157
MongoDB是一款开源的NoSQL数据库,主要应用于数据规模庞大的场合,并被视为Node.js的黄金搭档,由于它采用的是Binary JSON格式,所以与JavaScript具有任何语言都无法媲美的亲和力。关于它的具体介绍本文不作详细阐述,下面主要针对MongoDB在Windows下加入本地服务项...
分类:
数据库 时间:
2014-09-01 12:20:13
阅读次数:
254
树的求和属于树的题目中比较常见的,因为可以有几种变体,灵活度比较高,也可以考察到对于树的数据结构和递归的理解。一般来说这些题目就不用考虑非递归的解法了(虽然其实道理是跟LeetCode总结 -- 树的遍历篇一样的,只要掌握了应该没问题哈)。 LeetCode中关于树的求和有以下题目:Path SumPath Sum IISum Root to Leaf NumbersBinary Tree Max...
分类:
其他好文 时间:
2014-09-01 10:45:53
阅读次数:
147
A family hierarchy is usually presented by a pedigree tree. Your job is to count those family members who have no child.InputEach input file contains ...
分类:
其他好文 时间:
2014-08-31 22:46:42
阅读次数:
354
LeetCode: Unique Binary Search TreesGiven n, how many structurally unique BST's (binary search trees) that store values 1...n? For example,Given n = 3...
分类:
其他好文 时间:
2014-08-31 22:41:31
阅读次数:
361
LeetCode: Binary Tree Inorder TraversalGiven a binary tree, return the inorder traversal of its nodes' values. For example:Given binary tree {1,#,2,3}...
分类:
其他好文 时间:
2014-08-31 22:38:11
阅读次数:
215
Path Sum
Total Accepted: 20393 Total
Submissions: 66674My Submissions
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...
分类:
其他好文 时间:
2014-08-31 21:33:41
阅读次数:
284
Path Sum II
Total Accepted: 18489 Total
Submissions: 68323My Submissions
Given a binary tree and a sum, find all root-to-leaf paths where each path's sum equals the given sum.
For exampl...
分类:
其他好文 时间:
2014-08-31 21:28:11
阅读次数:
180
题目链接:点击打开链接
== 原来写1的时候已经把更新函数写好了。。
#include
#include
#include
#include
#include
#include
#include
using namespace std;
#define N 50050
#define Lson(x) tree[x].l
#define Rson(x) tree[x].r
...
分类:
其他好文 时间:
2014-08-31 20:08:01
阅读次数:
247
Binary Tree Preorder TraversalGiven a binary tree, return thepreordertraversal of its nodes' values.For example:Given binary tree{1,#,2,3}, 1 \ ...
分类:
其他好文 时间:
2014-08-31 18:34:41
阅读次数:
180