摘要: /** * Definition for binary tree * struct TreeNode { * int val; * TreeNode *left; * TreeNode *right; * TreeNode(int x) : val(x), left(NULL), right(NULL) {} * }; */class Solution {public: bool Less(TreeNode *root, int data) { if(root == NULL) return true; ... 阅读全文
posted @ 2014-04-08 22:45 jihite 阅读(581) 评论(0) 推荐(0) 编辑
摘要: 分析根结点固定时平衡二叉树个数=左孩子的个数 * 右孩子的个数。又左孩子或右孩子为空是不妨置为1,这样0个结点时,f(0) = 11个结点时,f(1) = f(0) * f(0) = 12个结点时,f(2) = f(0) * f(1) + f(1) * f(0)3个结点时,f(3) = f(0) *... 阅读全文
posted @ 2014-04-08 21:24 jihite 阅读(299) 评论(0) 推荐(0) 编辑